Skip to content

WHILL/whill-sdk-arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

whill-sdk-arduino

About

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.

Requirements

  • 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

Note: If you use a device supports HardwareSerial, the esp32 branch is available.

Getting Started

Download this repository and place on your Arduino library folder.

APIs

Initialize

WHILL(SoftwareSerial*)

Initialize WHILL instance with SoftwareSerial.

Power Control

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.

Motor Control

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.

Setting Change

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.

Data Fetching

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.

Data Reference

Battery

unsigned char  WHILL::battery.level
signed long    WHILL::battery.current

Remaining battery level and consumpting current[mA].

Motor State

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.

Speed Mode

bool   WHILL::speed_mode_indicator

Current selected speed mode.

Speed Profile

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.

Callback

By registering callback functions, you can hook at status is updated.
See Example: callback.ino

License

MIT License

About

Arduino library for Model CR series

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages