Created
November 30, 2017 10:51
-
-
Save ericdes/b38baa365ccc8d1dce35e677df98be67 to your computer and use it in GitHub Desktop.
TeensyE85.ino (initial release)
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
/* | |
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ericdes can you please contact me at dangen @ gmail.com? regarding your domain
Thanks!
Dan