This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://tronixstuff.com/2025/04/15/project-arduino-controlled-traffic-lights/ | |
// | |
// define the I/O pins that are used on the Arduino | |
// ... the buttons | |
#define westButton 5 | |
#define eastButton 12 | |
// the LEDs on the traffic light modules | |
#define westRed 4 | |
#define westYellow 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#include <Adafruit_BMP085.h> | |
#include <Wire.h> | |
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); | |
Adafruit_BMP085 bmp; | |
int temperature; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#include <Wire.h> | |
void TCA9548A(uint8_t bus) | |
{ | |
Wire.beginTransmission(0x70); // TCA9548A address is 0x70 | |
Wire.write(1 << bus); // send byte to select bus | |
Wire.endTransmission(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BMP180 library - https://github.com/adafruit/Adafruit-BMP085-Library | |
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#include <Adafruit_BMP085.h> | |
#include <Wire.h> | |
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); | |
Adafruit_BMP085 bmp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#include <Wire.h> | |
void TCA9548A(uint8_t bus) | |
{ | |
Wire.beginTransmission(0x70); // TCA9548A address is 0x70 | |
Wire.write(1 << bus); // send byte to select bus | |
Wire.endTransmission(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <U8g2lib.h> | |
#include <Wire.h> | |
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); | |
void setup() { | |
u8g2.begin(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// data receiver sketch | |
// | |
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino | |
// | |
// | |
#include <VirtualWire.h> | |
// use onboard LED for status | |
const int ledPin = 13; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// data transmitter sketch | |
// | |
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino | |
// | |
// | |
#include <VirtualWire.h> | |
// use onboard LED for status | |
const int ledPin = 13; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// receiver sketch | |
// | |
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino | |
// | |
#include <VirtualWire.h> | |
uint8_t buf[VW_MAX_MESSAGE_LEN]; | |
uint8_t buflen = VW_MAX_MESSAGE_LEN; | |
void setup() | |
{ | |
vw_set_ptt_inverted(true); // Required for RF link modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// transmitter sketch | |
// | |
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino | |
// | |
#include <VirtualWire.h> | |
uint8_t buf[VW_MAX_MESSAGE_LEN]; | |
uint8_t buflen = VW_MAX_MESSAGE_LEN; | |
const char *on2 = "a"; | |
const char *off2 = "b"; | |
const char *on3 = "c"; |
NewerOlder