Get drivers object (controls basically everything)

  pico::Drivers *drivers = new pico::Drivers();
  

allows for printing

  stdio_init_all();
  

init remote class

  drivers->remote.initialize();
  

prints “…..” while waiting for controller to connect

      std::cout << "." << std::endl;
  

Reading the remote before we check if it is connected yet or not.

      drivers->remote.read();
  

Returns true if connected

      drivers->remote.isConnected()
  

get value of left horizontal “joystick”

  float remoteValue = drivers->remote.getChannel(pico::communication::serial::Remote::Channel::LEFT_HORIZONTAL);
  

prints value

          std::cout << "remote: " << drivers->remote.getChannel(pico::communication::serial::Remote::Channel::LEFT_HORIZONTAL) << std::endl;
  

Code:

  #include <iostream>
#include <drivers.h>
#include "pico/stdlib.h"

int main(int argc, char const *argv[])
{
    //get drivers(controls basically everything)
    pico::Drivers *drivers = new pico::Drivers();

    stdio_init_all();

    // init remote
    drivers->remote.initialize();
    while (1)
    {
        std::cout << "." << std::endl;
        drivers->remote.read(); // Reading the remote before we check if it is connected yet or not.
        if (drivers->remote.isConnected())
        {
            // get remote value
            float remoteValue = drivers->remote.getChannel(pico::communication::serial::Remote::Channel::LEFT_HORIZONTAL);
            // print out value
            std::cout << "remote: " << remoteValue << std::endl;
        }
    }
}