I am making a robot that basically performs the same functions of a single cell life form. From that starting point I hope to build upon it and make it more and more complex in terms of its functionality and design. The image shown in Figure 1 is shows the output of the micro-view view controller I am using for this project. The current code on the device just blinks a circle on the screen every second.
#include <MicroView.h>
/*
MicroView Blink
Draw a circle for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
uView.begin();
uView.clear(PAGE);
}
// the loop routine runs over and over again forever:
void loop() {
uView.circleFill(32,24,10,WHITE,NORM);
uView.display();
delay(1000); // wait for a second
uView.circleFill(32,24,10,BLACK,NORM);
uView.display();
delay(1000); // wait for a second
}
The next step is to flash an external led. This was done by connecting an LED to pin 4 and updating the code to set the pin high and low every second, shown in Figure 2.
#include <MicroView.h>
/*
MicroView Blink
Draw a circle for one second, then off for one second, repeatedly.
Also flash an LED connected to pin A3 at the same time.
This example code is in the public domain.
*/
int LED = A3; // declare LED as pin A3 of MicroView
// the setup routine runs once when you press reset:
void setup() {
uView.begin();
uView.clear(PAGE);
pinMode(LED, OUTPUT); // set LED pin as OUTPUT
}
// the loop routine runs over and over again forever:
void loop() {
uView.circleFill(32,24,10,WHITE,NORM);
uView.display();
digitalWrite(LED, HIGH); // set LED pin HIGH voltage, LED will be on
delay(1000); // wait for a second
uView.circleFill(32,24,10,BLACK,NORM);
uView.display();
digitalWrite(LED, LOW); // set LED pin LOW voltage, LED will be off
delay(1000); // wait for a second
}
Comments
Please log in or sign up to comment.