Updated for latest PlatformIO

This commit is contained in:
2023-10-27 23:49:02 +02:00
parent 627c0e3884
commit ee5c88e9b2
+17 -10
View File
@@ -1,11 +1,10 @@
/*************************************
* CAN-bus receive
* arduino-can-bus-receive
* Author: Michel Bats
* Website: www.batssoft.nl
* Version: 0.0.2
* Revision: 20190418
*************************************/
#include <Arduino.h>
#include <SPI.h>
#include <mcp_can.h>
#include <Adafruit_GFX.h>
@@ -40,6 +39,8 @@ Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// Initialisatie mcp_can
MCP_CAN CAN(MCP_CAN_SPI_CS_PIN);
void canIdToReadChange();
// SETUP
void setup()
{
@@ -98,7 +99,6 @@ void loop()
unsigned int canId = CAN.getCanId();
if (canId == canIdToRead)
{
bufDisp[0] = buf[0];
@@ -133,7 +133,9 @@ void loop()
if (i == 3)
{
display.println(bufDisp[i], HEX);
} else {
}
else
{
display.print(bufDisp[i], HEX);
display.print(" ");
}
@@ -147,10 +149,12 @@ void loop()
display.display();
display.clearDisplay();
tel++;
if (tel > 999999) {
if (tel > 999999)
{
tel = 0;
}
} else if (tel == 0)
}
else if (tel == 0)
{
display.setCursor(0, 0);
display.println(" SEL CUR DIS");
@@ -169,12 +173,15 @@ void loop()
}
}
void canIdToReadChange() {
while(digitalRead(INTERRUPT_PIN) == 0){
void canIdToReadChange()
{
while (digitalRead(INTERRUPT_PIN) == 0)
{
delay(250);
}
canIdCount++;
if (canIdCount > CAN_ID_COUNT) {
if (canIdCount > CAN_ID_COUNT)
{
canIdCount = 0;
}
canIdToRead = canIdToReadArray[canIdCount];