Blink Test With Virtual Display, DumbDisplay
by Trevor Lee in Circuits > Arduino
721 Views, 1 Favorites, 0 Comments
Blink Test With Virtual Display, DumbDisplay
This instructable is intended to show you how to run the usual Arduino Uno blink test, but this time, with virtual LED rendered on your Android phone.
By using DumbDisplay, you should be able to more quickly design/prototype your Arduino experiment, and defer connecting real gadgets until later stage of your experiment.
The Sketch
The sketch is a bit more complicated than normal blink test sketch. Nevertheless, it should be easy and obvious enough.
#include "dumbdisplay.h"
// create the DumbDisplay object; assuming USB connection with 115200 baud
DumbDisplay dumbdisplay(new DDInputOutput(115200));
// declare a LED layer object, to be created in setup()
LedGridDDLayer *led;
void setup() {
// create the LED layer object, with only a single LED
led = dumbdisplay.createLedGridLayer();
// give the LED a color, when it is off
led->offColor("lightgray");
// give the LED a boxy border; note that the border size unit is the size of a LED
// make the border blue
led->border(0.1, "blue");
}
void loop() {
// toggle the LED
led->toggle();
// delay for half a second
delay(500);
}
Setup the IDE
In order to be able to compile and run the sketch shown above, you will first need to install the DumbDisplay Arduino library.
Open your Arduino IDE; go to the menu item Tools | Manage Libraries, and type "dumbdisplay" in the search box there.
Then click install the item shown.
Somethings Still Missing
Sorry, life is actually more complicated that this.
Other than this simple sketch for your Arduino Uno, you will need to prepare two more addition things:
- You will need to be able to attach your Arduino Uno to your Android phone. To do this, you will need an OTG adaptor, which allows you to plug your Arduino Uno to your phone via the usual USB cable.
- You will certainly need to install the DumbDisplay Android app.
Upload the Sketch and Run It
Assuming you have attached your Arduino Uno to your Arduino IDE, and selected the correct board and port, try uploading the sketch and see how it works.
After uploading the sketch, re-plug the USB cable to your phone via an OTG adaptor. Then, open the DumbDisplay Android app on your phone, and make connection.
Enjoy!
Peace be with you. Jesus loves you. May God bless you.