Arduino/Catmonster/Catmonster.ino

79 lines
1.7 KiB
Arduino
Raw Normal View History

// pinMode 0: leg down, 1: leg up
const int pinLegFL = 11;
const int pinLegBL = 9;
const int pinLegML = 10;
const int pinLegFR = 6;
const int pinLegBR = 4;
const int pinLegMR = 5;
// pinMode 0: leg back 1: leg forward
const int pinMoveFBR = 2;
const int pinMoveMR = 3;
const int pinMoveFBL = 7;
const int pinMoveML = 8;
const int delayTime = 500;
void setup() {
pinMode(pinLegFL, OUTPUT);
pinMode(pinLegML, OUTPUT);
pinMode(pinLegBL, OUTPUT);
pinMode(pinLegFR, OUTPUT);
pinMode(pinLegMR, OUTPUT);
pinMode(pinLegBR, OUTPUT);
pinMode(pinMoveFBR, OUTPUT);
pinMode(pinMoveFBL, OUTPUT);
pinMode(pinMoveMR, OUTPUT);
pinMode(pinMoveML, OUTPUT);
digitalWrite(pinLegFL, 0);
digitalWrite(pinLegML, 0);
digitalWrite(pinLegBL, 0);
digitalWrite(pinLegFR, 0);
digitalWrite(pinLegMR, 0);
digitalWrite(pinLegBR, 0);
digitalWrite(pinMoveFBR, 1);
digitalWrite(pinMoveFBL, 1);
digitalWrite(pinMoveMR, 1);
digitalWrite(pinMoveML, 1);
}
void loop() {
delay(delayTime);
digitalWrite(pinLegFL, 1);
digitalWrite(pinLegBL, 1);
digitalWrite(pinLegMR, 1);
delay(delayTime);
digitalWrite(pinMoveFBR, 0);
digitalWrite(pinMoveML, 0);
digitalWrite(pinMoveFBL, 1);
digitalWrite(pinMoveMR, 1);
delay(delayTime);
digitalWrite(pinLegFL, 0);
digitalWrite(pinLegBL, 0);
digitalWrite(pinLegMR, 0);
delay(delayTime);
digitalWrite(pinLegFR, 1);
digitalWrite(pinLegBR, 1);
digitalWrite(pinLegML, 1);
delay(delayTime);
digitalWrite(pinMoveFBL, 0);
digitalWrite(pinMoveMR, 0);
digitalWrite(pinMoveFBR, 1);
digitalWrite(pinMoveML, 1);
delay(delayTime);
digitalWrite(pinLegFR, 0);
digitalWrite(pinLegBR, 0);
digitalWrite(pinLegML, 0);
}