Skip to content

Commit

Permalink
finish read with pullup command
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Kelly committed Jun 30, 2013
1 parent f994aa9 commit 0576011
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions Test_Jig_Firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ unsigned long period;
unsigned long stepsToHome = 0;
unsigned long testStart;
uint8_t i, j;
uint8_t posCounter[5] = {0,0,0,0,0};
uint8_t consecutiveReads[5] = {0,0,0,0,0};
uint8_t posCounter[5] = {
0,0,0,0,0};
uint8_t consecutiveReads[5] = {
0,0,0,0,0};
byte startReads = 0;
unsigned long stepperCount[5][10];
char port;
Expand All @@ -44,7 +46,7 @@ void setup()
rambo::portSetMicroSteps(16);
//init digipots
digipot::init();

//setup pins
pinMode(ENDSTOP_PIN, INPUT); //Endstop
digitalWrite(ENDSTOP_PIN,HIGH); //turn on endstop pullups
Expand All @@ -67,25 +69,25 @@ void setup()
pinMode(Z_MS2_PIN, OUTPUT); //microstep pin
pinMode(E0_MS2_PIN, OUTPUT); //microstep pin
pinMode(E1_MS2_PIN, OUTPUT); //microstep pin
/*
pinMode(X_REF,INPUT);
pinMode(Y_REF,INPUT);
pinMode(Z_REF,INPUT);
pinMode(E0_REF,INPUT);
pinMode(E1_REF,INPUT);
pinMode(MOS1,INPUT);
pinMode(MOS2,INPUT);
pinMode(MOS3,INPUT);
pinMode(MOS4,INPUT);
pinMode(MOS5,INPUT);
pinMode(MOS6,INPUT);
digitalWrite(MOS1,HIGH);
digitalWrite(MOS2,HIGH);
digitalWrite(MOS3,HIGH);
digitalWrite(MOS4,HIGH);
digitalWrite(MOS5,HIGH);
digitalWrite(MOS6,HIGH);


pinMode(Y_REF,INPUT);
pinMode(Z_REF,INPUT);
pinMode(E0_REF,INPUT);
pinMode(E1_REF,INPUT);
pinMode(MOS1,INPUT);
pinMode(MOS2,INPUT);
pinMode(MOS3,INPUT);
pinMode(MOS4,INPUT);
pinMode(MOS5,INPUT);
pinMode(MOS6,INPUT);
digitalWrite(MOS1,HIGH);
digitalWrite(MOS2,HIGH);
digitalWrite(MOS3,HIGH);
digitalWrite(MOS4,HIGH);
digitalWrite(MOS5,HIGH);
digitalWrite(MOS6,HIGH);
*/
startMillis = millis();
Serial.print("1");
}
Expand All @@ -111,21 +113,16 @@ void loop()
delay(10);
switch (currentChar)
{
//Read Port or Pin but turn pullups on
//Format: R<pin> or R<port char>
//Returns: <port int val>\n or <pin val>\n
//Read Pin but turn pullups on
//Format: Q<pin>
//Returns: <pin val>\n
case 'Q' :
{
if(isAlpha(Serial.peek()))
{
port = Serial.read();
DEBUG_PRINT("Reading port : ", port);
Serial.println(getPin(port));
}
else if(isDigit(Serial.peek())){
if(isDigit(Serial.peek())){
pin = Serial.parseInt();
pinMode(pin,INPUT);
Serial.println(digitalRead(pin));
digitalWrite(pin,HIGH);
Serial.println(digitalRead(pin));
}
finished();
break;
Expand All @@ -145,7 +142,7 @@ void loop()
else if(isDigit(Serial.peek())){
pin = Serial.parseInt();
pinMode(pin,INPUT);
Serial.println(digitalRead(pin));
Serial.println(digitalRead(pin));
}
finished();
break;
Expand Down Expand Up @@ -435,3 +432,4 @@ void finished(void){




0 comments on commit 0576011

Please sign in to comment.