[examples] DigitalCommunication, I2CCommunication: Add tests (#4865)

This commit is contained in:
Starlight220
2023-01-09 02:33:53 +02:00
committed by GitHub
parent 2cd9be413f
commit 79f565191e
13 changed files with 709 additions and 74 deletions

View File

@@ -0,0 +1,25 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <array>
#include <frc/I2C.h>
#include <frc/TimedRobot.h>
/**
* This is a sample program demonstrating how to communicate to a light
* controller from the robot code using the roboRIO's I2C port.
*/
class Robot : public frc::TimedRobot {
public:
void RobotPeriodic() override;
static constexpr frc::I2C::Port kPort = frc::I2C::Port::kOnboard;
private:
static constexpr int deviceAddress = 4;
frc::I2C arduino{kPort, deviceAddress};
};