David
> --
> You received this message because you are subscribed to the Google Groups "iRobot Create Forum" group.
> To post to this group, send email to irobot-cr...@googlegroups.com.
> To unsubscribe from this group, send email to irobot-create-f...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/irobot-create-forum?hl=en.
>
I also have code in there that dumps some debug to the serial port,
which you can see by using the serial monitor in the arduino dev app.
http://arduino.cc/en/Main/Software
David
int i;
int up;
int led=2;
int dock_on=0;
int CREATE_POWER_SWITCH = 22; // digital output pin
int CREATE_POWER_ON = 34; // digital input pin
void setup() {
pinMode(CREATE_POWER_SWITCH, OUTPUT); // controls power on create
pinMode(CREATE_POWER_ON, INPUT);
if (digitalRead(CREATE_POWER_ON) == LOW) {
digitalWrite(CREATE_POWER_SWITCH, LOW);
digitalWrite(CREATE_POWER_SWITCH, HIGH); // switch power on
digitalWrite(CREATE_POWER_SWITCH, LOW);
delay(3500);
}
// initialize USB port
Serial.begin(9600);
// initialize serial port and create interface
Serial3.begin(57600);
Serial3.print(128, BYTE);
Serial3.print(132, BYTE);
i=0;
up=1;
}
void loop() {
// update LED color
Serial.print("led = ");
Serial.print(led);
Serial3.print(139, BYTE);
Serial3.print(led, BYTE);
Serial3.print(i, BYTE);
Serial3.print(250, BYTE);
if (up) {
i++;
if (i==255) {
up = 0;
}
}
else {
i--;
if (i==0) {
up = 1;
}
}
// get bump sensor state
Serial3.print(142, BYTE);
Serial3.print(7, BYTE);
int bump = Serial3.read();
Serial.print(" bump = ");
Serial.print(bump);
if (bump > 0 && dock_on == 0) { // either bump bit high
led=8;
dock_on = 1;
Serial.print(" was bumped");
Serial3.print(136, BYTE);
Serial3.print(1, BYTE); // attemp cover and dock
}
//
// if (Serial.available()) {
// int inByte = Serial.read();
// Serial3.print(inByte, BYTE);
// }
Serial.print("\n");