
| Current Path : /var/www/web-klick.de/dsh/50_dev2017/1330__canpy/scripts/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/50_dev2017/1330__canpy/scripts/main.c |
// demo: CAN-BUS Shield, send data
#include <mcp_can.h>
#include <SPI.h>
#include "StringOperation.h"
// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
MESSAGETOSEND SignalToMSG(SIGNALTOSEND Test)
void setup()
{
Serial.begin(115200);
START_INIT:
if(CAN_OK == CAN.begin(CAN_500KBPS)) // init can bus : baudrate = 500k
{
Serial.println("CAN BUS Shield init ok!");
}
else
{
Serial.println("CAN BUS Shield init fail");
Serial.println("Init CAN BUS Shield again");
delay(100);
//goto START_INIT;
}
}
void loop()
{
unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
float TestIntValue= 131071u;
String thisString = String(TestIntValue, BIN);
Serial.println(thisString);
while(1);
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/