Skip to content

Commit

Permalink
Blink updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KautzA committed Mar 26, 2019
1 parent c64a31a commit 5349122
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 6 additions & 2 deletions HexapodCodeV4/a_presetup.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@


//Error LED
#define LED_RUNNING 24 //red led by Xbee
#define LED_ERROR 12 //yellow led by Xbee
#define LED_RUNNING 12 //red led by Xbee
#define LED_ERROR 24 //yellow led by Xbee

//UI LEDs
#define LED_RGB_ON HIGH //On state for LEDs
Expand All @@ -55,6 +55,7 @@
#define BUTTON_RGB_PIN 20 //the button on the indicator button
#define BUTTON_RGB_MODE INPUT_PULLUP //pinmode for the indicator button pin


#define ServoI2C Wire1

#define NUM_LEGS 4
Expand Down Expand Up @@ -227,6 +228,9 @@ const int kInitialPositions [NUM_LEGS] [3] = {//x,y,z
#define COG_X 52 // distance that the legs are in left and right of the COG (center of gravity)
#define COG_Y 65 // distance that the legs are in front and behind the COG

//Period of the status LED
unsigned int led_running_period = 2000;

//Variable used to output from functions
uint8_t current_voltage = 0; //battery voltage in tenths
unsigned long last_voltage_read = 0;
Expand Down
16 changes: 13 additions & 3 deletions HexapodCodeV4/c_loop.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,19 @@ void loop() {
#endif

//Blink the running LED
uint8_t led_state= abs((time_1%510)-255);
analogWrite(LED_RUNNING,led_state);
analogWrite(LED_RGB_BLU,led_state);
//uint8_t led_state= abs((time_1%led_running_period)/(led_running_period/512)-255);
if (time_1%2000<1000){
digitalWrite(LED_RUNNING,HIGH);
digitalWrite(LED_RGB_BLU,HIGH);
digitalWrite(LED_RGB_RED,HIGH);
digitalWrite(LED_RGB_GRE,HIGH);
}
else{
digitalWrite(LED_RUNNING,LOW);
digitalWrite(LED_RGB_BLU,LOW);
digitalWrite(LED_RGB_RED,LOW);
digitalWrite(LED_RGB_GRE,LOW);
}

//Handle error LED patterns
if(error_state & B00000001){//DXL Error
Expand Down

0 comments on commit 5349122

Please sign in to comment.