Things used in this project

Schematics

Poor Man's CAN circuit
Poor man can bb u7mbmdcksd
Poor Man's CAN schematics
Poor man can schem bdgzky5dje

Code

CAN receiver codeArduino
Flash to the Photon with the button
const auto ledPin = A3;
const auto ledPowerPin = A6;
CANChannel can(CAN_D1_D2);
const auto canSpeed = 500000;

void setup() {
  pinMode(ledPowerPin, OUTPUT);
  digitalWrite(ledPowerPin, HIGH);
  pinMode(ledPin, OUTPUT);
  can.begin(canSpeed);
}

void loop() {
  CANMessage message;

  while(can.receive(message)) {
    if (message.id == 0x100) {
      digitalWrite(ledPin, !message.data[0]);
    }
  }

  delay(100);
}
CAN transmitter codeArduino
Flash to the Photon with the LED
const auto buttonPin = D4;
const auto buttonPowerPin = D6;
CANChannel can(CAN_D1_D2);
const auto canSpeed = 500000;

void setup() {
  pinMode(buttonPowerPin, OUTPUT);
  digitalWrite(buttonPowerPin, HIGH);
  pinMode(buttonPin, INPUT_PULLDOWN);
  pinMode(D7, OUTPUT);
  can.begin(canSpeed);
}

void loop() {
  bool button = digitalRead(buttonPin);
  digitalWrite(D7, button);
  CANMessage message;

  message.id = 0x100;
  message.len = 1;
  message.data[0] = button;

  can.transmit(message);

  delay(100);
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Well House Temperature Manager
Easy
  • 280
  • 6

Full instructions

Monitors the temperature of the well house to prevent the well from freezing.

Drink Alert!!! (Beverage Can Monitor)
Easy
  • 340
  • 4

Full instructions

Tired of going to grab a soda only to find they're all gone!? Well now you have an alert system to let you know when you need to refill.

The Food Thief Catcher
Easy
  • 149
  • 4

Work in progress

Are you tired of all of your pesky roommates stealing your food? Me too, thats why we have the Food Thief Catcher!

Happy Wife =  Happy Life
Easy
  • 255
  • 3

Full instructions

Wife not a morning person? Improve your life by improving your wife's temperament in the morning. Fresh coffee makes wife happy!

Happy Wife = Happy Life

Team We Are Not Coders

Temperature Sensor
Easy
  • 390
  • 5

Full instructions

A photon that measures the temperature and humididty with a DHT 22 sensor and communicates the temperature data to another photon.

Motion Activated Room Light
Easy
  • 155
  • 4

Full instructions

With this project, you'll never have to search for the light switch in the dark again.

Add projectSign up / Login
Respect project