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
Example
OzAnalogSensor
OzButtonController
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
OzAnalogJoystickController OzAnalogJoystickController | OzAnalogSensor OzAnalogSensor

Arduino Mega 2560

Analog Joysticks can be moved or pressed. Before using a joystick do not forget to lay it on a flat surface and leave it in the center position. Finally send a reset message to the joystick. After the origo is set you can move it in 4 directions and press the top button. Every joystick manipulation will generate an event. Joysticks can be used for interacting with physical or digital environments.

Required hardware

  • Arduino Mega 2560
  • Joystick
  • Resistor 1kΩ

Source code to install on controller


Before you upload this code to your Arduino, please format the EEPROM...
#include <OzIDManager.h>
#include <OzAnalogJoyController.h>

// global pointers
OzIDManager* manager;
OzAnalogJoyController* analogJoyController;

// Joystick pins
const int buttonPin = 2;
const int xPin = A1;
const int yPin = A0;

void setup()
{
  Serial.begin(115200);

  manager = new OzIDManager;
  manager->_sendACK = true;
  manager->_checksum = true;
  
  OzCommunication::setIDManager(manager);

  analogJoyController = new OzAnalogJoyController(xPin, yPin, buttonPin);
  analogJoyController->reset(); //resets origo to current position

  int x=1;
  manager->sendLinkSetup();
  manager->PrintWelcomeLine(analogJoyController, x++, "MyJoystick");
}

void loop()
{
  OzCommunication::communicate();
  analogJoyController->update();
}

Copyright © 2000- - Ozeki Ltd | info@ozeki.hu
Home > Technology > Robotics > Building robot software > Introduction/Protocols > DeviceHandlers > OzAnalogJoystickController > Example
Legal | Privacy policy | Terms of use
Page: 1570 | Login | 35.173.47.43