tahamajs's picture
download
raw
790 Bytes
#ifndef SENSOR_H
#define SENSOR_H
#include <CPS4042/Sketchs/AbstractSketch.h>
#include <CPS4042/Hardwares/Sensors/VL530x.h>
#include <cstdlib>
#include <thread>
#include <chrono>
class Sensor : public AbstractSketch<Sensors::Vl530x> {
public:
Sensor(Sensors::Vl530x* board, uint16_t minVal, uint16_t maxVal)
: AbstractSketch<Sensors::Vl530x>(board), m_min(minVal), m_max(maxVal) {}
std::int32_t setup(Sensors::Vl530x::Gpio&) override { return 0; }
std::int32_t loop(Sensors::Vl530x::Gpio&) override {
uint16_t d = m_min + (std::rand() % (m_max - m_min + 1));
this->board()->updateDistance(d);
std::this_thread::sleep_for(std::chrono::milliseconds(200));
return 0;
}
private:
uint16_t m_min, m_max;
};
#endif

Xet Storage Details

Size:
790 Bytes
·
Xet hash:
1df03029b5be7426a77fa27a828920fa06e79b6416511916319db15e1f13d30d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.