I am trying to search for a code to couple the Centipede to the Arduino Mega2560, using the Cetipede 64 pin to work with a simple programme such as 1 input on the Mega and sequence of timings;
int pin2 = 2;
int pin3 = 3;
int pin4 = 4;
int pin5 = 5;
int pin6 = 6;
int pin7 = 7;
int pin8 = 8;
int pin9 = 9;
int pin10 = 10;
int pin11 = 11;
int pin12 = 12;
int pin13 = 13;
int pin14 = 14;
int pin15 = 15;
int pin16 = 16;
int pin17 = 17;
int pin18 = 18;
int pin19 = 19;
int pin20 = 20;
int pin21 = 21;
int pin22 = 22;
int pin23 = 23;
int pin24 = 24;
int pin25 = 25;
int timer1 = 500;
int timer2 = 500;
int timer3 = 500;
int val = 0;
int state = HIGH; // the current state of the output pin
int reading; // the current reading from the input pin
int previous = LOW; // the previous reading from the input pin
long time = 0; // the last time the output pin was toggled
long debounce = 200; // the debounce time, increase if the output flickers
int interval = 500;
void setup(){
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
pinMode(pin6, OUTPUT);
pinMode(pin7, OUTPUT);
pinMode(pin8, OUTPUT);
pinMode(pin9, OUTPUT);
pinMode(pin10, OUTPUT);
pinMode(pin11, OUTPUT);
pinMode(pin12, OUTPUT);
pinMode(pin13, OUTPUT);
pinMode(pin14, OUTPUT);
pinMode(pin15, OUTPUT);
pinMode(pin16, OUTPUT);
pinMode(pin17, OUTPUT);
pinMode(pin18, OUTPUT);
pinMode(pin19, OUTPUT);
pinMode(pin20, OUTPUT);
pinMode(pin21, OUTPUT);
pinMode(pin22, OUTPUT);
pinMode(pin23, OUTPUT);
pinMode(pin24, INPUT);
pinMode(pin25, INPUT);
}
void loop() {
reading = digitalRead(pin25);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
// ... invert the output
if (state == HIGH)
state = LOW;
else
state = HIGH;
// ... and remember when the last button press was
time = millis();
digitalWrite(pin12, HIGH);
digitalWrite(pin10, HIGH);
delay(timer3);
digitalWrite(pin2, HIGH);
delay(timer1);
digitalWrite(pin3, HIGH);
delay(timer1);
digitalWrite(pin2, LOW);
digitalWrite(pin4, HIGH);
delay(timer1);
digitalWrite(pin3, LOW);
digitalWrite(pin5, HIGH);
delay(timer1);
digitalWrite(pin4, LOW);
digitalWrite(pin6, HIGH);
delay(timer1);
digitalWrite(pin5, LOW);
digitalWrite(pin7, HIGH);
delay(timer1);
digitalWrite(pin6, LOW);
digitalWrite(pin8, HIGH);
delay(timer1);
digitalWrite(pin7, LOW);
digitalWrite(pin9, HIGH);
delay(timer1);
digitalWrite(pin8, LOW);
delay(timer1);
digitalWrite(pin9, LOW);
digitalWrite(pin10, LOW);
digitalWrite(pin12, LOW);
delay(timer2);
}
//round2
reading = digitalRead(pin24);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
// ... invert the output
if (state == HIGH)
state = LOW;
else
state = HIGH;
// ... and remember when the last button press was
time = millis();
digitalWrite(pin13, HIGH);
digitalWrite(pin11, HIGH);
delay(timer3);
digitalWrite(pin2, HIGH);
digitalWrite(pin9, HIGH);
delay(timer1);
digitalWrite(pin3, HIGH);
digitalWrite(pin8, HIGH);
delay(timer1);
digitalWrite(pin2, LOW);
digitalWrite(pin9, LOW);
digitalWrite(pin4, HIGH);
digitalWrite(pin7, HIGH);
delay(timer1);
digitalWrite(pin3, LOW);
digitalWrite(pin8, LOW);
digitalWrite(pin5, HIGH);
digitalWrite(pin6, HIGH);
delay(timer1);
digitalWrite(pin4, LOW);
digitalWrite(pin7, LOW);
delay(timer1);
digitalWrite(pin5, LOW);
digitalWrite(pin6, LOW);
digitalWrite(pin11, LOW);
digitalWrite(pin13, LOW);
delay(timer2);
}
}
Hope I get a reply, I am messed up.