Welcome page
Products
Technology
SMS solutions
Databases
Modbus
M-Bus
PBX systems
Robotics
Building robot hardware
Building electronics
Building robot software
Introduction/Protocols
Architecture
How to develop a devhandler
Line protocol
DeviceHandlers
Oz433Mhz Transceiver
OzAnalogJoystickController
OzAnalogSensor
OzButtonController
Example
OzBuzzerController
OzDCMotorControllerL298N
OzDHTController
OzEEPROMController
OzKeyboardController
OzGyroscopeSensor
OzIDManager
OzIRTransceiver
OzLCDController
OzNfcReader
OzOpticalGateController
OzRegisterManipulation
OzRF24Transceiver
OzRgbLedController
OzRGB_Sensor
OzRotaryController
OzServoController
OzStepCounter
OzStepperMotorMultiController
OzSwitchController
OzTemperatureController
OzTimer
OzUltrasonicSensor
Examples
Bootloader
Robot training
Upload Arduino code
Company


Ozeki 10
OzAnalogSensor OzAnalogSensor | Example Example

OzButtonController

OzButtonController uses a protocol to check the status of any button wired to the microcontroller.

How to build a test circuit with a button and an Arduino Mega?
Arduino codes are included.

I. "Welcome" event from microcontroller

Example

c=welcome&type=OzButtonController&id=A47vvH&pos=2&t=3

Parameters

Parameter Type Range Functionality
c String 'welcome' Identifies the welcome message.
type String 'OzButtonController' Determines the type of the device.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.
pos Byte 0-255 Determines the position of the device on the list of the ID manager of the microcontroller. Please make sure there are no other devices in the same position.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



II. Commands to microcontroller

'EnablePullup' command

Adds resistor to button pin by setting it HIGH in INPUT mode. It is useful if there is a problem with the button. Malfunctions can happen if the button is not grounded, which can be prevented by using this command.

c=enablepullup&state=1&id=A47vvH&t=0

Parameters

Parameter Type Range Functionality
c String 'enablepullup' Identifies the command.
state Bool 0,1 With 1 you can add an integrated resistor, 0 disconnects the integrated resistor. If the button is perfectly wired, it should work in both states.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of commands. Counts from 0 to 255 then from 0 again.

Response

c=enablepullup_resp&state=1&id=A47vvH&t=4

Parameters

Parameter Type Range Functionality
c String 'enablepullup_resp' Identifies the event.
state Bool 0,1 If 1 the resistor is connected, 0 means the integrated resistor is disconnected. If the button is in perfect condition it should work in both states.
id String 6 characters (numbers, uppercase and lowercase characters) The ID of the device which is chosen by the microcontroller.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



'GetState' command

This command returns the actual state of the connected button.

c=getstate&id=A47vvH&t=1

Parameters

Parameter Type Range Functionality
c String 'getstate' Identifies the command.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.

Response

c=getstate_resp&state=1&id=A47vvH&t=5

Parameters

Parameter Type Range Functionality
c String 'getstate_resp' Identifies the response.
state Bool 0,1 It is the actual state of the button. 0 means LOW STATE, 1 means HIGH STATE.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



'SetMode' command

This command sets the mode of the 'ButtonStateChange' event.

c=setmode&mode=3&id=A47vvH&t=2

Parameters

Parameter Type Range Functionality
c String 'setmode' Identifies the command.
mode Byte 1: change
2: falling
3: rising
Sets which cases the 'ButtonStateChange' event should be sent.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.

Response

The mode of the 'ButtonStateChange' event has been set.

c=setmode_resp&state=3&id=A47vvH&t=6

Parameters

Parameter Type Range Functionality
c String 'setmode_resp' Identifies the response.
mode Byte 1: change
2: falling
3: rising
Responds the mode of the 'ButtonStateChange' event.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



'GetMode' command

Requests how the 'ButtonStateChange' event works.

c=getmode&id=A47vvH&t=3

Parameters

Parameter Type Range Functionality
c String 'getmode' Identifies the command.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of commands sent. Counts from 0 to 255 then from 0 again.

Response

The current mode of the 'ButtonStateChange' event.

c=getmode_resp&state=3&id=A47vvH&t=7

Parameters

Parameter Type Range Functionality
c String 'getmode_resp' Identifies the response.
mode Byte 1: change
2: falling
3: rising
Responds the mode of the 'ButtonStateChange' event.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.



III. Event from microcontroller

'ButtonStateChange' event

This event is sent from the microcontroller if the button is pressed or released. It depends on the mode you have previously set.

Example

//Button state changed to false
c=buttonstatechange&state=0&id=A47vvH&t=1

//Button state changed to true
c=buttonstatechange&state=1&id=A47vvH&t=2

Parameters

Parameter Type Range Functionality
c String 'buttonstatechange' Identifies the event.
state Bool 0,1 It is the actual state of the button. 0 means LOW STATE, 1 means HIGH STATE.
id String 6 characters (numbers, uppercase and lowercase characters) Identifies the device. The ID is never changed during communication.
t Byte 0-255 Counts the number of events and responses sent combined. Counts from 0 to 255 then from 0 again.

Copyright © 2000- - Ozeki Ltd | info@ozeki.hu | Tel: +36 1 371 0150
Home > Technology > Robotics > Building robot software > Introduction/Protocols > DeviceHandlers > OzButtonController
Legal | Privacy policy | Terms of use
Page: 1599 | Login | 54.161.100.24