Junichi Katsu / Mbed 2 deprecated BLE_MPU6050_test6_challenge_sb

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

wallbotble Class Reference

wallbotble Class Reference

wallbot ble control class More...

#include <wallbotble.h>

Public Member Functions

 wallbotble ()
 Create the wallbot object connected to the default pins.
void set_f_sensor_gain (int gain)
 Set Sensor gain.
void f_sensor_calibrate (void)
 Sensor calibrate.
void left_motor (float speed)
 Directly control the speed and direction of the left motor.
void right_motor (float speed)
 Directly control the speed and direction of the right motor.
void forward (float speed)
 Drive both motors forward as the same speed.
void backward (float speed)
 Drive both motors backward as the same speed.
void left_turn (float speed)
 Drive left motor backwards and right motor forwards at the same speed to turn on the spot.
void right_turn (float speed)
 Drive left motor forward and right motor backwards at the same speed to turn on the spot.
void stop (void)
 Stop both motors.
int GetLinePosition (void)
 Get floorline position.
int GetSw (void)
 Get switch .
void set_led (int bit)
 Set status led .
void set_led1 (int bit)
 Set led1 .
void set_led2 (int bit)
 Set led2 .

Detailed Description

wallbot ble control class

Example:

 // Drive the wwallbot forward, turn left, back, turn right, at half speed for half a second

#include "mbed.h"
#include "wallbotble.h"

wallbotble wb;
 
int main() {

    wb.sensor_calibrate();

    while(!wb.GetSw())
    {
        wb.set_led(wb.GetLinePosition());
    }
    
    wb.forward(1.0);
    wait (1.0);
    wb.left(1.0);
    wait (1.0);
    wb.backward(1.0);
    wait (1.0);
    wb.right(1.0);
    wait (1.0);
    
    wb.stop();

    while(1);

 }

Definition at line 71 of file wallbotble.h.


Constructor & Destructor Documentation

wallbotble (  )

Create the wallbot object connected to the default pins.

Definition at line 30 of file wallbotble.cpp.


Member Function Documentation

void backward ( float  speed )

Drive both motors backward as the same speed.

Parameters:
speedA normalised number 0 - 1.0 represents the full range.

Definition at line 55 of file wallbotble.cpp.

void f_sensor_calibrate ( void   )

Sensor calibrate.

Definition at line 112 of file wallbotble.cpp.

void forward ( float  speed )

Drive both motors forward as the same speed.

Parameters:
speedA normalised number 0 - 1.0 represents the full range.

Definition at line 50 of file wallbotble.cpp.

int GetLinePosition ( void   )

Get floorline position.

(int value return.)

Definition at line 140 of file wallbotble.cpp.

int GetSw ( void   )

Get switch .

(switch OFF:0 or ON:1 return.)

Definition at line 163 of file wallbotble.cpp.

void left_motor ( float  speed )

Directly control the speed and direction of the left motor.

Parameters:
speedA normalised number -1.0 - 1.0 represents the full range.

Definition at line 42 of file wallbotble.cpp.

void left_turn ( float  speed )

Drive left motor backwards and right motor forwards at the same speed to turn on the spot.

Parameters:
speedA normalised number 0 - 1.0 represents the full range.

Definition at line 60 of file wallbotble.cpp.

void right_motor ( float  speed )

Directly control the speed and direction of the right motor.

Parameters:
speedA normalised number -1.0 - 1.0 represents the full range.

Definition at line 46 of file wallbotble.cpp.

void right_turn ( float  speed )

Drive left motor forward and right motor backwards at the same speed to turn on the spot.

Parameters:
speedA normalised number 0 - 1.0 represents the full range.

Definition at line 65 of file wallbotble.cpp.

void set_f_sensor_gain ( int  gain )

Set Sensor gain.

Parameters:
Sensorgain.

Definition at line 108 of file wallbotble.cpp.

void set_led ( int  bit )

Set status led .

Parameters:
led(bit0:LEFT bit2:RIGHT)

Definition at line 75 of file wallbotble.cpp.

void set_led1 ( int  bit )

Set led1 .

Parameters:
led(0:off,1:on)

Definition at line 80 of file wallbotble.cpp.

void set_led2 ( int  bit )

Set led2 .

Parameters:
led(0:off,1:on)

Definition at line 94 of file wallbotble.cpp.

void stop ( void   )

Stop both motors.

Definition at line 70 of file wallbotble.cpp.