Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup(){
- Serial.begin(9600);
- for (int i=4; i<=7; i++){
- pinMode(i,OUTPUT);
- }
- }
- int quotient = 0;
- int x = 0;
- void loop(){
- function1();
- encode();
- }
- void function1(){
- x = x+16*millis()/100;
- quotient = x%16;
- }
- void function2(){
- x = millis()/50;
- if (x%2==0) quotient=15*(millis()%50)/50;
- else quotient = 15*(1-(millis()%50)/50);
- }
- void encode(){
- for (int i=4; i<=7, i++){
- digitalWrite(i,quotient%2);
- quotient = quotient/2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement