Skip to content

Commit

Permalink
Stop flashing the LED based on the WiFi state - just pulse to show th…
Browse files Browse the repository at this point in the history
…e Arduino is alive
  • Loading branch information
bjpirt committed Jul 9, 2015
1 parent 0723a4f commit 69702aa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Mirobot
version=2.0.1
version=2.0.2
author=Ben Pirt <[email protected]>
maintainer=Ben Pirt <[email protected]>
sentence=This is the library that makes Mirobot (http://mirobot.io) work.
paragraph=Mirobot is an easy to use robotics kit for teaching kids about technology. This library contains the main firmware as well as the routines you need to program it yourself directly.
category=Other
url=http://mirobot.io
architectures=avr
architectures=avr
25 changes: 2 additions & 23 deletions src/Mirobot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ void* bl = (void *) 0x3c00;

Mirobot::Mirobot(){
blocking = true;
mainState = POWERED_UP;
lastLedChange = millis();
version(2);
}
Expand Down Expand Up @@ -43,8 +42,6 @@ void Mirobot::setup(Stream &s){
p.setup(s, self());
// Set up the status LED
pinMode(STATUS_LED, OUTPUT);
// Set up the ready pin to communicate with the WiFi module
pinMode(WIFI_READY, INPUT); //nReady
penup();
initHwVersion();
}
Expand Down Expand Up @@ -202,14 +199,6 @@ void Mirobot::setPenState(penState_t state){
next_servo_pulse = 0;
}

void Mirobot::checkState(){
if(!digitalRead(WIFI_READY)){
mainState = CONNECTED;
}else{
mainState = POWERED_UP;
}
}

void Mirobot::followHandler(){
if(motor1.ready() && motor2.ready()){
int diff = analogRead(LEFT_LINE_SENSOR) - analogRead(RIGHT_LINE_SENSOR);
Expand Down Expand Up @@ -256,18 +245,8 @@ void Mirobot::collideHandler(){
}

void Mirobot::ledHandler(){
checkState();
switch(mainState){
case POWERED_UP:
if(millis() - lastLedChange > 250){
lastLedChange = millis();
digitalWrite(STATUS_LED, !digitalRead(STATUS_LED));
}
break;
case CONNECTED:
digitalWrite(STATUS_LED, HIGH);
break;
}
long t = millis();
digitalWrite(STATUS_LED, (!((t / 100) % 10) || !(((t / 100) - 2) % 10)));
}

void Mirobot::servoHandler(){
Expand Down
7 changes: 1 addition & 6 deletions src/Mirobot.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
#define STEPS_PER_MM_V2 STEPS_PER_TURN / CIRCUMFERENCE_MM_V2
#define STEPS_PER_DEGREE_V2 ((WHEEL_DISTANCE_V2 * 3.1416) / 360) * STEPS_PER_MM_V2

#define WIFI_RESET 3
#define WIFI_READY 2
#define STATUS_LED 13

#define MIROBOT_VERSION "2.0.1"
#define MIROBOT_VERSION "2.0.2"

#define MAGIC_BYTE_1 0xF0
#define MAGIC_BYTE_2 0x0D
Expand All @@ -44,8 +42,6 @@
#define LEFT_COLLIDE_SENSOR A3
#define RIGHT_COLLIDE_SENSOR A2

typedef enum {POWERED_UP, CONNECTED} mainState_t;

typedef enum {UP, DOWN} penState_t;

typedef enum {NORMAL, RIGHT_REVERSE, RIGHT_TURN, LEFT_REVERSE, LEFT_TURN} collideState_t;
Expand Down Expand Up @@ -95,7 +91,6 @@ class Mirobot {
void initHwVersion();
char lastCollideState;
int lastFollowState;
mainState_t mainState;
collideState_t _collideState;
unsigned long lastLedChange;
Mirobot& self() { return *this; }
Expand Down

0 comments on commit 69702aa

Please sign in to comment.