Skip to content

Commit

Permalink
"Solight" renamed to "DY01"
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixunil committed Jan 1, 2018
1 parent 17ff3da commit eb2fe0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions solight.cpp → dy01.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#include "solight.h"
#include "dy01.h"

Solight::Solight(int pin, int transmitCount) :
DY01::DY01(int pin, int transmitCount) :
mPin(pin),
mTransmitCount(transmitCount)
{
pinMode(mPin, OUTPUT);
}

void Solight::transmitBit(uint8_t b) {
void DY01::transmitBit(uint8_t b) {
digitalWrite(mPin, HIGH);
delayMicroseconds(150 + 300*b);
digitalWrite(mPin, LOW);
delayMicroseconds(450 - 300*b);
}

void Solight::control(uint16_t socketNumber, char state) {
void DY01::control(uint16_t socketNumber, char state) {
uint16_t tmp;
int i, j;
for(j = 0; j < mTransmitCount; ++j) {
Expand Down Expand Up @@ -42,7 +42,7 @@ void Solight::control(uint16_t socketNumber, char state) {
}
}

void Solight::control(uint16_t channelNumber, char socketLetter, char state) {
void DY01::control(uint16_t channelNumber, char socketLetter, char state) {
channelNumber *= 32;
switch(socketLetter) {
case 'A':
Expand Down
4 changes: 2 additions & 2 deletions solight.h → dy01.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include "Arduino.h"

class Solight {
class DY01 {
public:
// If you set transmitCount to less than 2, it won't work!
Solight(int pin, int transmitCount = 5);
DY01(int pin, int transmitCount = 5);
void control(uint16_t socketNumber, char state);
void control(uint16_t channelNumber, char socketLetter, char state);
private:
Expand Down
8 changes: 4 additions & 4 deletions examples/Blink/Blink.ino
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <solight.h>
#include <dy01.h>

Solight solight(8);
DY01 transmitter(8);

void setup() {
}

void loop() {
solight.control(31, 'A', 1);
transmitter.control(31, 'A', 1);
delay(1000);
solight.control(31, 'A', 0);
transmitter.control(31, 'A', 0);
delay(1000);
}

0 comments on commit eb2fe0a

Please sign in to comment.