Update Overview with firmware code authored by Reid Schneyer's avatar Reid Schneyer
......@@ -11,4 +11,38 @@ Brandon write this part since he designed it?
same as above
# The Electronics
See here: https://git.ece.iastate.edu/danc/MicroCART/-/wikis/Test-Stand/Electronics
\ No newline at end of file
See here: https://git.ece.iastate.edu/danc/MicroCART/-/wikis/Test-Stand/Electronics
# The Firmware
``` cpp
int analogPin = A10;
int btnPin = 9;
int val = 0;
double scalar = 0.3516; // 360/1024
int homePosition;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(btnPin, INPUT);
homePosition = analogRead(analogPin);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(btnPin)){
homePosition = analogRead(analogPin);
}
val = analogRead(analogPin);
double actDeg = scalar * (double) val;
double adjDeg = scalar * (double) homePosition;
//Serial.println("////////////////////////////////////////////");
Serial.println(actDeg);
//Serial.println(homePosition);
//Serial.println(actDeg - adjDeg);
//Serial.println("////////////////////////////////////////////");
//delay(100);
}
```
\ No newline at end of file