#Binary
3 posts tagged “Binary”
3 posts tagged “Binary”
int numLed = 10; int ledpins[] = { 13,12,11,10,9,8,7,6,5,4}; int mask[] = { 1,2,4,8,16,32,64,128,256,512}; int counter = 0;void setup() {
// initialize the digital pin as an output. for (int i=0;i<numLed;i++){ pinMode(ledpins[i], OUTPUT); digitalWrite(ledpins[i], HIGH); delay(250); } }
/* Binary Second Counter Created Alastair Montgomery 22/11/2012 */int ledPins[] = { 7,8,9,10,11,12}; int mask[] = { 1,2,4,8,16,32}; int ledCount = 6;
void setup() { for (int thisPin =0; thisPin < ledCount; thisPin++) { pinMode(ledPins[thisPin], OUTPUT); } }
Quick sanity check of my new Arduino board using a LED Bar Graph.
int led1 = 8; int led2 = 9; int counter = 0;void setup() {
// initialize the digital pin as an output. pinMode(led1, OUTPUT); pinMode(led2, OUTPUT);
}void loop() {
if (counter & 1) { digitalWrite(led1, HIGH); } else { digitalWrite(led1, LOW); }