I am currently working on project that will output some date (Date and Time) through a BBB.
I want to output this to an SSD 1306 128 x 32 OLED. I have looked throught the Adafruit Tutorial (https://learn.adafruit.com/ssd1306-oled ... k?view=all) but I would really like to do this using Javascript.
How would I go about doing this? Are there any libraries set up that can do this? Or can anyone point me in the right direction?
Thanks.
Interfacing SSD1306 OLED Screen with Javascript?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jgutierrez33
- Posts: 2
- Joined: Wed Apr 01, 2015 11:29 am
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interfacing SSD1306 OLED Screen with Javascript?
You'd have to look at the Bonescript system to see what it takes to control the pins, then port the Python code over to Javascript.
- jgutierrez33
- Posts: 2
- Joined: Wed Apr 01, 2015 11:29 am
Re: Interfacing SSD1306 OLED Screen with Javascript?
Im trying to use I2C to control the pins, but what do you mean "port the code"?
Sorry, Im bit of a beginner with the BBB (and coding in general) so I apologize if I dont fully comprehend what you are saying.
Sorry, Im bit of a beginner with the BBB (and coding in general) so I apologize if I dont fully comprehend what you are saying.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Interfacing SSD1306 OLED Screen with Javascript?
The term 'porting' means translating code from one system to another. It could be from one kind of computer to another, or from one language to another. You have to read and understand the ideas behind the original code well enough to implement those same ideas for a different computer or language.
The end product is two programs that act the same even though they may look different. The simpler parts of both programs will look the same.. adding two numbers is pretty much "x+y" everywhere.. but things like data structures usually have to be redone to fit the new environment.
As with translating between normal languages, it's easiest to port code if you're fluent in both languages. Every computer language worth using has the same set of fundamental operations (called 'Turing-completeness') which allow you to build solutions to a given class of problems. All Turing-complete languages can solve the same class of problems, which includes being able to implement any Turing-complete language (writing a C compiler in Javascript for instance, or vice versa).
Experienced programmers learn several programming languages to get a better feel for the ideas that make any language Turing-complete. Once you have that, moving from one language to another isn't too hard.
It's a lot for a beginner to take in all at once, but it's never too early to get comfortable with multiple languages. Javascript and Python are both pretty friendly, so I'd suggest learning to work with the Adafruit BBIO code that does talk to the OLED display while also writing other code in Javascript. Start accumulating that sense of, "how do I convert what I'm doing in this language to that other language?"
As you get more comfortable, read the source code for the libraries and helper classes you're using and get experience learning how to convert code to structured ideas.. it's a valuable skill to have when you start trying to go the other way.
The end product is two programs that act the same even though they may look different. The simpler parts of both programs will look the same.. adding two numbers is pretty much "x+y" everywhere.. but things like data structures usually have to be redone to fit the new environment.
As with translating between normal languages, it's easiest to port code if you're fluent in both languages. Every computer language worth using has the same set of fundamental operations (called 'Turing-completeness') which allow you to build solutions to a given class of problems. All Turing-complete languages can solve the same class of problems, which includes being able to implement any Turing-complete language (writing a C compiler in Javascript for instance, or vice versa).
Experienced programmers learn several programming languages to get a better feel for the ideas that make any language Turing-complete. Once you have that, moving from one language to another isn't too hard.
It's a lot for a beginner to take in all at once, but it's never too early to get comfortable with multiple languages. Javascript and Python are both pretty friendly, so I'd suggest learning to work with the Adafruit BBIO code that does talk to the OLED display while also writing other code in Javascript. Start accumulating that sense of, "how do I convert what I'm doing in this language to that other language?"
As you get more comfortable, read the source code for the libraries and helper classes you're using and get experience learning how to convert code to structured ideas.. it's a valuable skill to have when you start trying to go the other way.
Please be positive and constructive with your questions and comments.