This week we're looking at producing a few boards, and then networking these together through serial communication. After that, the boards will be programmed so that they can be addressed from a computer through the main Bus board. I started out by loading up the traces into the Fab Modules and send them off to the Modela. After the board was milled, I soldered the parts onto it.
The Board
My serial networking communication
Codes Used
#includeint Rx = 1; int Tx = 2; SoftwareSerial serial(Rx, Tx); const int buttonPin = 3; const int pin= 4; int ledState = LOW; int buttonState; int lastButtonState = LOW; unsigned long lastDebounceTime = 0; unsigned long debounceDelay = 50; void setup() { serial.begin(4800); pinMode(buttonPin, INPUT); pinMode(pin, OUTPUT); digitalWrite(pin, ledState); } void loop() { int reading = digitalRead(buttonPin); if (reading != lastButtonState) { lastDebounceTime = millis(); } if ((millis() - lastDebounceTime) > debounceDelay) { if (reading != buttonState) { buttonState = reading; if (buttonState == HIGH) { ledState = !ledState; } } digitalWrite(pin, ledState); lastButtonState = reading; } if (serial.available()){ if (serial.readString() == "gas linking"){ digitalWrite(pin, LOW); serial.println("gas closed"); } } }