Skip to content

Instantly share code, notes, and snippets.

@ericdes
Created November 30, 2017 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericdes/b38baa365ccc8d1dce35e677df98be67 to your computer and use it in GitHub Desktop.
Save ericdes/b38baa365ccc8d1dce35e677df98be67 to your computer and use it in GitHub Desktop.
TeensyE85.ino (initial release)
/*
Authors: Eric Desgranges
Licensed under the GNU General Public License v3.0
*/
#include <FlexCAN.h>
// Teensy 2.0 has the LED on pin 11
// Teensy++ 2.0 has the LED on pin 6
// Teensy 3.x / Teensy LC have the LED on pin 13
const int ledPin = 13;
// -------------------------------------------------------------
static void hexDump(uint8_t dumpLen, uint8_t *bytePtr)
{
uint8_t hex[17] = "0123456789abcdef";
uint8_t working;
while (dumpLen--) {
working = *bytePtr++;
Serial.write(hex[working >> 4]);
Serial.write(hex[working & 15]);
}
Serial.write('\r');
Serial.write('\n');
}
// -------------------------------------------------------------
void setup(void)
{
pinMode(ledPin, OUTPUT); digitalWrite(ledPin, HIGH); delay(200); digitalWrite(ledPin, LOW); // Blink once!
Can0.begin();
Serial.println(F("Hello Teensy E85!"));
}
// -------------------------------------------------------------
void loop(void)
{
CAN_message_t rxMsg;
while (Can0.available())
{
Can0.read(rxMsg);
Serial.print("CAN BUS: "); hexDump(8, rxMsg.buf);
}
}
@dangen
Copy link

dangen commented May 27, 2018

@ericdes can you please contact me at dangen @ gmail.com? regarding your domain
Thanks!
Dan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment