forked from melodyians/melodyian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hardware_arduino.h
51 lines (36 loc) · 1.25 KB
/
hardware_arduino.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include "components.h"
#include "types.h"
class ArduinoInterface : public HardwareInterface {
private:
void setupPins();
// Pins
static const byte redPin = 9; //LED 'Red' connected to pin 9
static const byte greenPin = 11; //LED 'Green' connected to pin 10
static const byte bluePin = 10; //LED 'Blue' connected to pin 11
// Motor Pins
static const byte STBY = 4; //standby pin
// Motor A
static const byte PWMA = 5; //Speed control of motor A
static const byte AIN1 = 3; //Direction pin
static const byte AIN2 = 2; //Direction pin
// Motor B
static const byte PWMB = 6; //Speed control of motor B
static const byte BIN1 = 7; //Direction - moved to 3 from 6
static const byte BIN2 = 8; //Direction pin
// Tone and Amplitude
static const byte tonePin = 12;
static const byte ampSDNpin = 13;
//const byte bat1MonPin = A0; // input pin for battery 1 divider
//byte bat2MonPin = 1; //input pin for battery 2 divider
public:
ArduinoInterface();
void writeToLED(byte red, byte green, byte blue);
void moveMotor(int motor, int motorSpeed, int motorDirection);
void stopMotors();
int readBattery();
void playTone(unsigned int freq);
void toneOff();
bool ampIsOn();
void setAmpPower(bool on);
};