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

2-Way Particle Photon Communication
Easy
  • 132
  • 4

Make two Particle Photons "talk" via the usage of webhooks!

E-Paper Weather Display with Photon and IFTTT
Easy
  • 749
  • 9

Full instructions

Create a beautiful medium for weather information using Particle's cloud services and IFTTT.

IFTTT - Enabled Sensors with Particle Photon
Easy
  • 660
  • 11

Full instructions

Connect any sensor to Particle Photon and use it to trigger an IFTTT action with just a few lines of code.

Light Detecting Email Sender
Easy
  • 208
  • 4

Full instructions

Receive an email about when the light is too strong on your device; nobody wants a heated device left directly under the sun. Photon + IFTTT

WiFi Strength Meter
Easy
  • 4
  • 0

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

Internet-Connected Popcorn Popper
Easy
  • 141
  • 1

Full instructions

A hot air popcorn popper triggered via the Internet! (Built for the Bellingham Codes May event.)

Add projectSign up / Login