Announcement

Collapse
No announcement yet.

Send number info via Serial

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31


    I have to receive at 115200 as the program from the computer that interprets and sends values to the arduino from the flight simulator only sends at 115200. Where I'm having the issue is the arduino and display don't communicate correctly at that baud so I have to change the baud rate to receive the info, then switch it back to send to the display. I'm wondering if I have written the code correctly as posted in my last post on the previous page.

    Thanks

    Comment


    • #32


      Um, so what value is the arduino adding to the equation?

      Um again, so you have both devices connected on the same serial port?

      Why not use different ports? or put one on softserial if you only have a single port Arduino?
      Mark

      Comment


      • #33


        I have the arduino set up to receive the information and the display receiving the information from the arduino. I tried getting my computer to send directly to the display but that didn't work. I might try again though with the program I was given to interpret the arduino stuff. it might actually work...

        Comment


        • #34


          Well this may solve many of the issues I'm having... its no receiving the info directly from the program. The program sends one long string that looks like this

          Comment


          • #35


            That should be reasonably simple, do you known how to decode that information further?

            Eg,

            Does the < indicate the end of a number, eg D01139< ?
            What are the sizes of each number (fixed or variable)?
            What formatting is needed around the numbers?
            Mark

            Comment


            • #36


              Ya thinking over it more I think I know how to do it and make it work. Its sending them as ASCII characters so I think I can adjust the code to do what I need it to. I'll try what I'm thinking and if that doesn't work I'll ask what I'm doing wrong again haha.

              The < signifies the beginning of a new output. You choose what things you want to display and it begins each item with a < then the signifier (ie. D,P,J) if that makes sense

              Comment


              • #37


                Right, so when you get the D,J,P save it and init magicnumber to 0

                Then for every character do something like

                magicnumber := magicnumber * 10 + (serin() & 0F) ;

                Then when you get the < the number in magicnumber is the previously saved value
                Mark

                Comment


                • #38


                  Alright well I have it communicating again. My last problem is getting the GUI to get worked out.

                  I'm using the LED custom digits that I'm trying to display in landscape mode.

                  This is a sample of one of the numbers (all of them are the same thing just different names/images/locations)

                  HTML Code:
                  // headingDigits1 1.0 generated 4/4/2014 2:50:57 PM
                      media_SetAdd(iheadingDigits1H, iheadingDigits1L) ;      // point to the headingDigits1 image
                      gfx_Set(SCREEN_MODE,PORTRAIT) ;        // On uTOLED-20-G2 videos+images only work in PORTRAIT
                      ledDigitsDisplayL(h1, iiheadingDigits1H, iiheadingDigits1L, 12, 12, 1, 1, 9, 0) ;
                      gfx_Set(SCREEN_MODE,LANDSCAPE) ;      // Restore 'operating' orientation
                  I've looked through the include file and noticed the have the different functions such as the L,D, and R that end the function. I believe that solved the issue the last time but it isn't this time. this is the code in the LEDDIGITSDISPLAYGOLDELOX.INC:

                  // WARNING, this code will crash if newval exceeds maximum displayable number
                  func ledDigitsDisplay(var newval, var indexH, var indexL, var left, var top, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)
                  var i, k, l, lb ;
                  l := 1 ;
                  for (i := 1; i < Digits; i++)
                  l *= 10 ;
                  next
                  lb := LeadingBlanks ;
                  for (i := 0; i < Digits; i++)
                  k := newval / l ;
                  newval -= k * l ;
                  if ( lb && (i < Digits - MinDigits)
                  if (k == 0)
                  k := 10 ;
                  else
                  lb := 0 ;
                  endif
                  endif
                  l /= 10 ;
                  media_SetAdd(indexH, indexL) ;
                  media_VideoFrame(left+i*WidthDigit, top, k) ;
                  next
                  endfunc

                  func ledDigitsDisplayD(var newval, var indexH, var indexL, var left, var top, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)
                  var i, k, l, lb ;
                  l := 1 ;
                  for (i := 1; i < Digits; i++)
                  l *= 10 ;
                  next
                  lb := LeadingBlanks ;
                  for (i := 0; i < Digits; i++)
                  k := newval / l ;
                  newval -= k * l ;
                  if ( lb && (i < Digits - MinDigits)
                  if (k == 0)
                  k := 10 ;
                  else
                  lb := 0 ;
                  endif
                  endif
                  l /= 10 ;
                  media_SetAdd(indexH, indexL) ;
                  media_VideoFrame(left-i*WidthDigit+(Digits-1)*WidthDigit+6, top, k) ;
                  next
                  endfunc

                  func ledDigitsDisplayR(var newval, var indexH, var indexL, var left, var top, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)
                  var i, k, l, lb ;
                  l := 1 ;
                  for (i := 1; i < Digits; i++)
                  l *= 10 ;
                  next
                  lb := LeadingBlanks ;
                  for (i := 0; i < Digits; i++)
                  k := newval / l ;
                  newval -= k * l ;
                  if ( lb && (i < Digits - MinDigits)
                  if (k == 0)
                  k := 10 ;
                  else
                  lb := 0 ;
                  endif
                  endif
                  l /= 10 ;
                  media_SetAdd(indexH
                  , indexL) ;
                  media_VideoFrame(left, top-i*WidthDigit+(Digits-1)*WidthDigit+6,k) ;
                  next
                  endfunc

                  func ledDigitsDisplayL(var newval, var indexH, var indexL, var left, var top, var Digits, var MinDigits, var WidthDigit, var LeadingBlanks)
                  var i, k, l, lb ;
                  l := 1 ;
                  for (i := 1; i < Digits; i++)
                  l *= 10 ;
                  next
                  lb := LeadingBlanks ;
                  for (i := 0; i < Digits; i++)
                  k := newval / l ;
                  newval -= k * l ;
                  if ( lb && (i < Digits - MinDigits)
                  if (k == 0)
                  k := 10 ;
                  else
                  lb := 0 ;
                  endif
                  endif
                  l /= 10 ;
                  media_SetAdd(indexH, indexL) ;
                  media_VideoFrame(left, top+i*WidthDigit,k) ;
                  next
                  endfunc

                  Comment


                  • #39
                    This is what it is displaying by the way... I'm trying to get those numbers below each label

                    Click image for larger version

Name:	1854081.jpg
Views:	20
Size:	3.24 MB
ID:	39617

                    Comment


                    • #40


                      Err that sort of looks like some of the parameters to ledDigitsDisplayx have changed and either the uSD was not rebuilt, or things were moved such that the parameters needed changing (try a repaste) but they weren't
                      Mark

                      Comment


                      • #41


                        I actually got it to work. Two of the values were misplaced.

                        Thanks again for all your help and I should be able to get all the other parts working without much difficulty!!

                        I'll post video in the next few weeks showing the final result.

                        Comment

                        Working...
                        X