GY-63_MS5611/libraries/optoma/optoma.cpp

81 lines
1.2 KiB
C++
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: optoma.cpp
// AUTHOR: Rob Tillaart
2021-12-22 07:38:25 -05:00
// VERSION: 0.1.3
2021-01-29 06:31:58 -05:00
// DATE: 2017-11-27
2021-12-22 07:38:25 -05:00
// PUPROSE: Arduino library to control Optoma W305ST beamer over RS232.
2021-01-29 06:31:58 -05:00
// URL: https://github.com/RobTillaart/optoma
//
// HISTORY
// 0.1.0 2017-11-27 initial version
// 0.1.1 2020-07-09 initial release
2021-12-22 07:38:25 -05:00
// 0.1.2 2020-01-02 Arduino-CI
// 0.1.3 2021-12-22 update library.json, license, readme, minor edits
2021-01-29 06:31:58 -05:00
#include "optoma.h"
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
Optoma::Optoma(HardwareSerial* stream)
{
_stream = stream;
}
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::init(int ID, uint32_t baudRate)
{
_ID = ID;
_stream->begin(baudRate);
_stream->print("# init : ");
_stream->print(baudRate);
_stream->print("\r");
}
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::switchOn()
{
sendID();
_stream->print(F("00 1\r"));
_on = true;
};
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::switchOff()
{
sendID();
_stream->print(F("00 0\r"));
_on = false;
};
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::increaseVKS()
{
sendID();
_stream->print(F("140 15\r"));
};
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::decreaseVKS()
{
sendID();
_stream->print(F("140 16\r"));
};
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
bool Optoma::isOn()
{
return _on;
};
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
void Optoma::sendID()
{
_stream->print('~');
if (_ID < 10) Serial.print('0');
_stream->print(_ID);
}
2021-12-22 07:38:25 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-22 07:38:25 -05:00