Skip to content

Commit

Permalink
Rename runtime variable to avoid clash in espressif sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
platisd committed Jun 7, 2020
1 parent 6e792ef commit 49dad75
Show file tree
Hide file tree
Showing 33 changed files with 120 additions and 117 deletions.
12 changes: 6 additions & 6 deletions examples/Car/DistanceCar/DistanceCar.ino
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#include <Smartcar.h>

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

const auto pulsesPerMeter = 600;

DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);

DistanceCar car(arduino, control, leftOdometer, rightOdometer);
DistanceCar car(arduinoRuntime, control, leftOdometer, rightOdometer);

void setup()
{
Expand Down
6 changes: 3 additions & 3 deletions examples/Car/FullSerialControl/FullSerialControl.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <Smartcar.h>

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

SimpleCar car(control);
Expand Down
8 changes: 4 additions & 4 deletions examples/Car/HeadingCar/HeadingCar.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const int GYROSCOPE_OFFSET = 37;
const unsigned long PRINT_INTERVAL = 100;
unsigned long previousPrintout = 0;

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

GY50 gyroscope(arduino, GYROSCOPE_OFFSET);
GY50 gyroscope(arduinoRuntime, GYROSCOPE_OFFSET);

HeadingCar car(control, gyroscope);

Expand Down
12 changes: 6 additions & 6 deletions examples/Car/PidControllerMonitor/PidControllerMonitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ const unsigned long PRINTOUT_INTERVAL = 100;
unsigned long previousPrintOut = 0;
float carSpeed = 0.5;

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

const auto pulsesPerMeter = 600;

DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);

DistanceCar car(arduino, control, leftOdometer, rightOdometer);
DistanceCar car(arduinoRuntime, control, leftOdometer, rightOdometer);

void setup()
{
Expand Down
6 changes: 3 additions & 3 deletions examples/Car/SimpleCar/SimpleCar.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <Smartcar.h>

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

SimpleCar car(control);
Expand Down
14 changes: 7 additions & 7 deletions examples/Car/SmartCar/SmartCar.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
const unsigned long PRINT_INTERVAL = 100;
unsigned long previousPrintout = 0;

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

GY50 gyroscope(arduino, 37);
GY50 gyroscope(arduinoRuntime, 37);

const auto pulsesPerMeter = 600;

DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);

SmartCar car(arduino, control, gyroscope, leftOdometer, rightOdometer);
SmartCar car(arduinoRuntime, control, gyroscope, leftOdometer, rightOdometer);

void setup()
{
Expand Down
14 changes: 7 additions & 7 deletions examples/Car/automatedMovements/automatedMovements.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ const float carSpeed = 1.0;
const long distanceToTravel = 40;
const int degreesToTurn = 90;

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

GY50 gyroscope(arduino, 37);
GY50 gyroscope(arduinoRuntime, 37);

const auto pulsesPerMeter = 600;

DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);

SmartCar car(arduino, control, gyroscope, leftOdometer, rightOdometer);
SmartCar car(arduinoRuntime, control, gyroscope, leftOdometer, rightOdometer);

void setup()
{
Expand Down
6 changes: 3 additions & 3 deletions examples/Car/manualControl/manualControl.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const int bSpeed = -70; // 70% of the full speed backward
const int lDegrees = -75; // degrees to turn left
const int rDegrees = 75; // degrees to turn right

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

SimpleCar car(control);
Expand Down
12 changes: 6 additions & 6 deletions examples/Car/manualWithCruiseControl/manualWithCruiseControl.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ const float bSpeed = -0.5; // a ground speed (m/sec)y for going backward
const int lDegrees = -75; // degrees to turn left
const int rDegrees = 75; // degrees to turn right

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

const auto pulsesPerMeter = 600;

DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);

DistanceCar car(arduino, control, leftOdometer, rightOdometer);
DistanceCar car(arduinoRuntime, control, leftOdometer, rightOdometer);

void setup()
{
Expand Down
8 changes: 4 additions & 4 deletions examples/Car/rotateOnSpot/rotateOnSpot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
const int carSpeed = 80; // 80% of the max speed
const int GYROSCOPE_OFFSET = 37;

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v2::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v2::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v2::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

GY50 gyroscope(arduino, GYROSCOPE_OFFSET);
GY50 gyroscope(arduinoRuntime, GYROSCOPE_OFFSET);

HeadingCar car(control, gyroscope);

Expand Down
6 changes: 3 additions & 3 deletions examples/Car/shieldMotorsTest/shieldMotorsTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

#include <Smartcar.h>

ArduinoRuntime arduino;
BrushedMotor leftMotor(arduino, smartcarlib::pins::v1::leftMotorPins);
BrushedMotor rightMotor(arduino, smartcarlib::pins::v1::rightMotorPins);
ArduinoRuntime arduinoRuntime;
BrushedMotor leftMotor(arduinoRuntime, smartcarlib::pins::v1::leftMotorPins);
BrushedMotor rightMotor(arduinoRuntime, smartcarlib::pins::v1::rightMotorPins);
DifferentialControl control(leftMotor, rightMotor);

SimpleCar car(control);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <Smartcar.h>

ArduinoRuntime arduino;
GY50 gyro(arduino, 0); // Provide the gyroscope with a random offset
ArduinoRuntime arduinoRuntime;
GY50 gyro(arduinoRuntime, 0); // Provide the gyroscope with a random offset

void setup()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <Smartcar.h>

ArduinoRuntime arduino;
ArduinoRuntime arduinoRuntime;
// Determine the offset for your gyroscope using the `getOffset` method
const int GYROSCOPE_OFFSET = 37;
GY50 gyro(arduino, GYROSCOPE_OFFSET);
GY50 gyro(arduinoRuntime, GYROSCOPE_OFFSET);

void setup()
{
Expand Down
5 changes: 3 additions & 2 deletions examples/sensors/infrareds/GP2D120/GP2D120.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

const int SIDE_FRONT_PIN = A0; // you can use only analog enabled pins

ArduinoRuntime arduino;
GP2D120 sideFrontIR(arduino, SIDE_FRONT_PIN); // measure distances between 5 and 25 centimeters
ArduinoRuntime arduinoRuntime;
GP2D120 sideFrontIR(arduinoRuntime,
SIDE_FRONT_PIN); // measure distances between 5 and 25 centimeters

void setup()
{
Expand Down
5 changes: 3 additions & 2 deletions examples/sensors/infrareds/GP2Y0A02/GP2Y0A02.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

const int SIDE_FRONT_PIN = A0;

ArduinoRuntime arduino;
GP2Y0A02 sideFrontIR(arduino, SIDE_FRONT_PIN); // measure distances between 25 and 120 centimeters
ArduinoRuntime arduinoRuntime;
GP2Y0A02 sideFrontIR(arduinoRuntime,
SIDE_FRONT_PIN); // measure distances between 25 and 120 centimeters

void setup()
{
Expand Down
5 changes: 3 additions & 2 deletions examples/sensors/infrareds/GP2Y0A21/GP2Y0A21.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

const int SIDE_FRONT_PIN = A0;

ArduinoRuntime arduino;
GP2Y0A21 sideFrontIR(arduino, SIDE_FRONT_PIN); // measure distances between 12 and 78 centimeters
ArduinoRuntime arduinoRuntime;
GP2Y0A21 sideFrontIR(arduinoRuntime,
SIDE_FRONT_PIN); // measure distances between 12 and 78 centimeters

void setup()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
const unsigned long LEFT_PULSES_PER_METER = 600;
const unsigned long RIGHT_PULSES_PER_METER = 740;

ArduinoRuntime arduino;
ArduinoRuntime arduinoRuntime;
DirectionalOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPins,
[]() { leftOdometer.update(); },
LEFT_PULSES_PER_METER);
DirectionalOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPins,
[]() { rightOdometer.update(); },
RIGHT_PULSES_PER_METER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const unsigned short odometerPin = 2;
const unsigned long pulsesPerMeter = 100;

ArduinoRuntime arduino;
ArduinoRuntime arduinoRuntime;
DirectionlessOdometer odometer(
arduino, odometerPin, []() { odometer.update(); }, pulsesPerMeter);
arduinoRuntime, odometerPin, []() { odometer.update(); }, pulsesPerMeter);

void setup()
{
Expand Down
4 changes: 2 additions & 2 deletions examples/sensors/odometer/singleOdometer/singleOdometer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const unsigned short odometerPin = 2;
const unsigned long pulsesPerMeter = 400;

ArduinoRuntime arduino;
ArduinoRuntime arduinoRuntime;
DirectionlessOdometer odometer(
arduino, odometerPin, []() { odometer.update(); }, pulsesPerMeter);
arduinoRuntime, odometerPin, []() { odometer.update(); }, pulsesPerMeter);

void setup()
{
Expand Down
6 changes: 3 additions & 3 deletions examples/sensors/odometer/twoOdometers/twoOdometers.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

const auto pulsesPerMeter = 600;

ArduinoRuntime arduino;
ArduinoRuntime arduinoRuntime;
DirectionlessOdometer leftOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::leftOdometerPin,
[]() { leftOdometer.update(); },
pulsesPerMeter);
DirectionlessOdometer rightOdometer(
arduino,
arduinoRuntime,
smartcarlib::pins::v2::rightOdometerPin,
[]() { rightOdometer.update(); },
pulsesPerMeter);
Expand Down
4 changes: 2 additions & 2 deletions examples/sensors/ultrasounds/SR04/SR04.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const int TRIGGER_PIN = 6; // D6
const int ECHO_PIN = 7; // D7
const unsigned int MAX_DISTANCE = 100;

ArduinoRuntime arduino;
SR04 front(arduino, TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
ArduinoRuntime arduinoRuntime;
SR04 front(arduinoRuntime, TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup()
{
Expand Down
4 changes: 2 additions & 2 deletions examples/sensors/ultrasounds/SRF08/SRF08.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const unsigned short GAIN = 0x1F; // maximum gain
const unsigned short RANGE = 0x07; // 7 for 34 centimeters
const unsigned short I2C_ADDRESS = 112;

ArduinoRuntime arduino;
SRF08 front(arduino, I2C_ADDRESS);
ArduinoRuntime arduinoRuntime;
SRF08 front(arduinoRuntime, I2C_ADDRESS);

void setup()
{
Expand Down
Loading

0 comments on commit 49dad75

Please sign in to comment.