Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetConfig(_CBR, 3) ' set baud to 250k
- SetConfig(_CHB, 100) ' set hearbeat to 100ms
- SetConfig(_CNOD, 0x27) ' set roboteq node source address to 0x27
- ' -- Tried using both RawCAN and MiniJ1939 (I had CAN connected and was able to read extended ID inclinometer sensor data, roboteq heartbeat and 4 other messages and send standard IDs with Vector CANalyzer)
- 'SetConfig(_CEN, 5) ' set mode to MiniJ1939 (ability to read extended IDs) and enable CAN
- 'SetConfig(_CEN, 3) ' set mode to RawCAN (read standard IDs, use _CF and _CAN) and enable CAN
- loop:
- If (GetValue(_CF, 1) > 0) Then
- print("Byte 1: ", GetValue(_CAN, 3), "\n")
- print("Byte 2: ", GetValue(_CAN, 4), "\n")
- receivedCAN = TRUE
- End If
- ' -- Activate LED light if we managed to read CAN (light does not activate)
- If (receivedCAN) Then
- SetCommand(_DSET, 2)
- Else
- SetCommand(_DRES, 2)
- End If
- wait(CONST_CYCLE_TIME)
- goto loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement