You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
686 B
C++
40 lines
686 B
C++
15 years ago
|
#include "WProgram.h"
|
||
|
void setup();
|
||
|
void loop();
|
||
|
void setup() {
|
||
|
pinMode(7, OUTPUT);
|
||
|
pinMode(6, OUTPUT);
|
||
|
pinMode(5, OUTPUT);
|
||
|
pinMode(4, OUTPUT);
|
||
|
pinMode(3, OUTPUT);
|
||
|
pinMode(2, OUTPUT);
|
||
|
}
|
||
|
|
||
|
int count = 0;
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
digitalWrite(7, (count & 0b100000) >> 5);
|
||
|
digitalWrite(6, (count & 0b010000) >> 4);
|
||
|
digitalWrite(5, (count & 0b001000) >> 3);
|
||
|
digitalWrite(4, (count & 0b000100) >> 2);
|
||
|
digitalWrite(3, (count & 0b000010) >> 1);
|
||
|
digitalWrite(2, (count & 0b000001) >> 0);
|
||
|
|
||
|
delay(1000);
|
||
|
count++;
|
||
|
}
|
||
|
|
||
|
int main(void)
|
||
|
{
|
||
|
init();
|
||
|
|
||
|
setup();
|
||
|
|
||
|
for (;;)
|
||
|
loop();
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|