The "whill-sdk-arduino" is a simple Arduino library for Model CR series.


We also have Model CR Series Technical Support for current and potential Model CR series users.
- Host device
- An Arduino device suports SoftwareSerial. e.g. Arduino Uno.
- Target device
- Model CR series (Normal Model C or Model C2 does not support serial communication.)
- Connector
- RS232C Shield (example)
Note: If you use a device supports HardwareSerial, the esp32 branch is available.
Download this repository and place on your Arduino library folder.
WHILL(SoftwareSerial*)
Initialize WHILL instance with SoftwareSerial.
WHILL::powerOn()
Turn on a WHILL.
WHILL::powerOff()
Turn off a WHILL.
WHILL::setBatteryVoltaegeOut(bool)
Enable/Disable power supply to the interface connector. True
to enable power supply.
Note: This command is for Model CR only.
WHILL::setJoystick(int x, int y)
Manipulate a WHILL via this command. Both x and y are integer values with range -100 ~ 100.
WHILL::setVelocity(int y, int x)
Control the speed of a WHILL directly via this command. y is integer values with range -500 ~ 1500 [0.004km/h]. x is integer values with range -750 ~ 750 [0.004km/h].
Attention: WHILL moves so quickly using SetVelocity command and so pay enough attention to use SetVelocity command. Basically, send this command to increase speed gradually.
WHILL::setSpeedProfile(SpeedProfile* profile, unsigned char speed_mode)
Change the speed profile of WHILL.
WHILL::setBatterySaving(int low_battery_level, bool sounds_buzzer)
Configure battery protection settings. low_battery_level is battery charge level to engage the standby mode with range 1 ~ 90. sounds_buzzer is Enable/Disable a buzzing sound at the battery charge level of low_battery_level + 10 percentage points. True to enable a buzzing sound when battery level low. As default, low_battery_level is 19 and sounds_buzzer is True.
Note: This command is for Model CR2 only.
WHILL::begin(unsigned int interval_ms)
Command WHILL to start reporting WHILL status.
WHILL::refresh()
Fetch serial interface and do internal process.
Call this function, WHILL::delay()
and/or WHILL::keep_joy_delay()
once at least in loop()
.
Callbacks are fired when these functions are called.
WHILL::stopSendingData()
Command WHILL to stop report WHILL status.
WHILL::updateSpeedProfile()
Command WHILL to update speed profile cache. If you want the latest speed profile, send this command.
unsigned char WHILL::battery.level
signed long WHILL::battery.current
Remaining battery level and consumpting current[mA].
float WHILL::left_motor.angle
int WHILL::left_motor.speed
float WHILL::right_motor.angle
int WHILL::right_motor.speed
Angle and speed of motors. The angle range is -PI to +PI, the speed unit is [km/h].
Note: The speed value is low-pass filtered.
bool WHILL::speed_mode_indicator
Current selected speed mode.
unsigned char WHILL::speed_profile[mode].forward_speed
unsigned char WHILL::speed_profile[mode].forward_acceleration
unsigned char WHILL::speed_profile[mode].forward_deceleration
unsigned char WHILL::speed_profile[mode].reverse_speed
unsigned char WHILL::speed_profile[mode].reverse_acceleration
unsigned char WHILL::speed_profile[mode].reverse_deceleration
unsigned char WHILL::speed_profile[mode].turn_speed
unsigned char WHILL::speed_profile[mode].turn_acceleration
unsigned char WHILL::speed_profile[mode].turn_deceleration
Current speed profile. mode
is 0 ~ 5.
By registering callback functions, you can hook at status is updated.
See Example: callback.ino
MIT License