***UPDATE*** There is updated code that works with the current Adafruit libraries! New post is here.
So I ordered a 2.8″ TFTLCD with touchscreen from Adafruit and really wanted to do more than 1 “screenfull” of stuff. So I stayed up all night and wrote this. Now I want to share it. I was waiting to post this until I got my code a little cleaned up and put in a good number of comments. My code might not be as optimal as it could be, so go easy on me, I’m still a newbie..
Here is a video about what this does.
And here is a video about the code.
JOS stands for Jeremy’s Operating System and is open source. I encourage you to use it, hack it, and do what ever you want with it. I know some might say “it’s not an operating system!” I know, but it’s just a name. It is based on Lady Ada’s TFTLCD and TouchScreen libraries. It shares some of the code from Lady Ada’s tftpaint sketch found in the TFTLCD library. It is written in the Arduino IDE and works perfect with the 2.8″ TFTLCD breakout board and the Touch Shield. This version does not support and SD card/bitmap functions as I do not have a touch shield yet. I will write these in when I get a Touch shield some day.
Here is a feature List:
Menu driven button screens
5 different menu screens, 6 buttons per screen for a total of 30 separate functions
Customizable title bar for indicators, custom icons and titles
Easily adjustable dual color signal indicator (for wireless application) for the title bar
Home icon for easy navigation
Dedicated message box for notifications
PWM controlled adjustable backlight
Settings menu with adjustable sleep time and backlight
Sleep and backlight settings saved in EEPROM – retains settings after power down
Sleep mode, for backlight, including fade in from sleep and fade out to sleep
Template for 3rd adjustable item on settings menu
Dual color battery icon with active and adjustable monitoring
LED output for button press indication – adjustable or removable
2 LED outputs for indication – adjustable or removable
All LED activity used only 2 pins
pins 0 and 1 not used and reserved for for serial communication
pins 11, A0, A1, A4, A5 open for I/O
Code is commented to explain function
Hardware Wiring: The same wiring as found in the Adafruit TFTLCD tutorial here.
ATmega328 Pins and Arduino pins:
(2) 0: N/C (open for communication)
(3) 1: N/C (open for communication)
(4) 2: data 2
(5) 3: data 3
(6) 4: data 4
(11) 5: data 5
(12) 6: data 6
(13) 7: data 7
(14) 8: data 0 && X+
(15) 9: data 1 && Y-
(16) 10: backlight
(17) 11: N/C
(18) 12: red LED
(19) 13: green LED
(23) 14(A0): N/C
(24) 15(A1): N/C
(25) 16(A2): X-
(26) 17(A3): Y+
(27) 18(A4): N/C
(28) 19(A5): N/C
(1) Reset: LCD Reset