WindRose 1.0
Custom Hardware , Firmware and Software for Robotic Cellular Automata Experiments
WindRose.h
Go to the documentation of this file.
1
9#ifndef WindRose_h
10#define WindRose_h
11
12#include <Arduino.h>
13#include "Directions.h"
14#include "SSMachine.h" //Machine State for reading neighbours data
15#include "WRMux.h" //WindRose Multiplexer class
16
18#define WRLED A2 //redefine LED_BUILTIN to be the WR LED pin
19
25 public:
26 void on(){
27 digitalWrite(WRLED, HIGH);
28 }
29 void off(){
30 digitalWrite(WRLED, LOW);
31 }
32 void toggle(){
33 digitalWrite(WRLED, !digitalRead(WRLED));
34 }
35};
36
43{
44 private:
45 public:
47 SSMachine ssm; //Serial State Machine
49 WRMux mux; //Multiplexer controller
51 LEDControl led; //LED controller
52
54 void init(uint16_t _baudrate){
55 pinMode(WRLED, OUTPUT); //Set the LED pin as output
56 this->led.on(); //Turn on the LED
57 Serial.begin(_baudrate); //Start the Serial Hardware at specified baudrate
58 this->ssm.setSerial(&Serial); //Set the serial port of the Serial State Machine
59 this->mux.init(); //Set up the WindRose Mux
60 }
61};
62
63#endif
This file defines cardinal and relative directions enumerations.
This file defines the WindRose's Serial State Machine Control class SSMachine.
This file defines the WindRose's Multiplexer Control class WRMux.
#define WRLED
defines the LED pin
Definition: WindRose.h:18
The class to control the LED.
Definition: WindRose.h:24
The class to control the Serial State Machine.
Definition: SSMachine.h:24
void setSerial(Stream *stmObject)
Initializes the Serial State Machine by setting its internal Stream object to a pointer to the Serial...
Definition: SSMachine.h:38
The class to control the WindRose Board (the body).
Definition: WindRose.h:43
void init(uint16_t _baudrate)
Initializes the board by starting the LED, the Mux, the Serial Hardware, and the State Machine.
Definition: WindRose.h:54
LEDControl led
The WindRose's LED control from the class LEDControl.
Definition: WindRose.h:51
WRMux mux
The WindRose's Multiplexer Control from the class WRMux.
Definition: WindRose.h:49
SSMachine ssm
The WindRose's Serial State Machine from the class SSMachine.
Definition: WindRose.h:47
The class for the WindRose Multiplexer Control.
Definition: WRMux.h:21
void init()
Initializes the WRMux class by seting the control pins as OUTPUT.
Definition: WRMux.h:39