Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 87ec21a

Browse files
Cleaning Code
- Added function declarations - Updated initialization of shield. Zero all pins.
1 parent aa73fc3 commit 87ec21a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

arduino_control/arduino_control.ino

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
#include <String.h>
1111
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
1212

13+
// function declarations
14+
void recvWithStartEndMarkers();
15+
void processData();
16+
void showNewData();
17+
void readValues();
18+
void stopMotor(int motor_number);
19+
void upMotor(int motor_number);
20+
void downMotor(int motor_number);
21+
1322
// variables
1423
const byte numChars = 32;
1524
char receivedChars[numChars];
@@ -46,7 +55,9 @@ void setup() {
4655
pwm.begin();
4756
pwm.setPWMFreq(50);
4857
delay(100);
49-
pwm.setPWM(0, 0, 0);
58+
for (int i=0; i<16; i++) {
59+
stopMotor(i);
60+
}
5061

5162
// alert user
5263
Serial.println("<Arduino is ready>");
@@ -57,9 +68,7 @@ void loop() {
5768
showNewData();
5869
}
5970

60-
//////////////////////////////////////
61-
//////////////////////////////////////
62-
//////////////////////////////////////
71+
// functions
6372

6473
void recvWithStartEndMarkers() {
6574
static boolean recvInProgress = false;

0 commit comments

Comments
 (0)