brighter Laser

This commit is contained in:
mrbesen 2019-01-04 12:39:44 +01:00
parent 965d3248e9
commit 4a7324888b
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 11 additions and 2 deletions

View File

@ -29,15 +29,24 @@ unsigned long lastmin;
//remove this line to enable Serial
#define nolog
void set(const unsigned char pin, bool on) {
if(on)
digitalWrite(pin, HIGH);
else
analogWrite(pin, offtime);
}
//prints the data to the lasers, write(0,0)-> all off, write()-> all on
void write(unsigned char m = 255, unsigned char h = 255) {
//write minutes
for(unsigned char i = 0; i < 6; i++) {
analogWrite(M[i], (m & (1 << i)) ? 255 : offtime);
set(M[i], m & (1 << i));
// analogWrite(M[i], (m & (1 << i)) ? 255 : offtime);
}
//write hour
for(unsigned char i = 0; i < 4; i++) {
analogWrite(H[i], (h & (1 << i)) ? 255 : offtime);
set(H[i], h & (1 << i));
// analogWrite(H[i], (h & (1 << i)) ? 255 : offtime);
}
#ifndef nolog
//send data to Serial