begin()
説明
CANBus関数を初期化する。
語法
CAN.begin()
CAN.begin(speed)
パラメータ
speed:CAN の送信速度は,以下の10 種類の速度から選ぶことが可能。このパラメーターは必ずしも必要なものではなく,もし設定を行わなくても,あらかじめ10KBPSで速度が設定されている。
- CAN_10KBPS
- CAN_20KBPS
- CAN_50KBPS
- CAN_83K3BPS
- CAN_100KBPS
- CAN_125KBPS
- CAN_250KBPS
- CAN_500KBPS
- CAN_833KBPS
- CAN_1000KBPS
戻り値
非戻り値
例
#include <CANBus.h>
unsigned char buf[8] = {0, 1, 2, 3, 4, 5, 6, 7};
void setup() {
Serial.begin(115200);
CAN.begin(CAN_500KBPS); // CANのトランスミッション速度を500KBPSに設定する
}
void loop() {
CAN.beginTransmission(0x00, CAN_STDID); // 外部のCAN device のID を 0x00とし,標準データ画像を使用する
CAN.write(buf, 8); // 8 bytesのデータを送信する
CAN.endTransmission(); // 送信完了
delay(10);
}
See also
- beginTransmission()
- write()
- endTransmission()
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
