Shop OBEX P1 Docs P2 Docs Learn Events
Menu on uoled128 looking for examples — Parallax Forums

Menu on uoled128 looking for examples

RonPRonP Posts: 384
edited 2011-09-23 10:24 in Propeller 1
Hello All,

Does anyone know of some examples in the OBEX possibly that would demonstrate a simple menu that would scroll up and down with button presses. I have 3 buttons hooked up that are pulled high with a press (Up, Down and Select). I'll post my code of how I thought it might work so you can see how far off I am. I am sure I am headed in the wrong direction with this code.
PUB TestButtons 'ModeNumber is a global variable
  OLED.INIT
  SETUP
  
  ModeNumber := 1
  dira[LED] := 1                'LED on pin 15 for debugging
  dira[Up..Down] := 0
 
  OLED.FTEXT(0,1, 2, 255,0,0, string("Mode 1 Display"),0)   'red                   
  OLED.FTEXT(0,3, 2, 255,255,0, string("Mode 2 Display"),0) 'yellow                       
  OLED.FTEXT(0,5, 2, 255,255,0, string("Mode 3 Display"),0)                    
  OLED.FTEXT(0,7, 2, 255,255,0, string("Mode 4 Display"),0)
  OLED.FTEXT(0,9, 2, 255,255,0, string("Mode 5 Display"),0)
  DELAY.PauseSec(10)

  
  repeat
    if ina[Down] == 1
      ModeNumber++
      
    elseif ina[Up] == 1
      ModeNumber--

      
      case ModeNumber
        1: OLED.FTEXT(0,1, 2, 255,0,0, string("Mode 1 Display"),0)
            
        2: OLED.FTEXT(0,3, 2, 255,0,0, string("Mode 2 Display"),0)
        3: OLED.FTEXT(0,5, 2, 255,0,0, string("Mode 3 Display"),0)
        4: OLED.FTEXT(0,7, 2, 255,0,0, string("Mode 4 Display"),0)
        5: OLED.FTEXT(0,9, 2, 255,0,0, string("Mode 5 Display"),0)
    

When the uOLED is turned on I would like it to display text in Yellow the default mode would be Mode 1 which will display Red and as push buttons are pressed the next line would change from Yellow to Red so you know what line you are on at anytime you could press Select button to jump to that Method.

Thanks for any input. :smile:

-Ron
Sign In or Register to comment.