mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-09-17 17:32:25 -07:00
Initial import of support files for all Digistump boards - Digispark, Pro, DigiX - including libraries, examples, tools, and other support files for the Arduino IDE
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include <TinyWireM.h>
|
||||
#define expander 0x20
|
||||
|
||||
byte expanderStatus = B11111111; //all off
|
||||
|
||||
void setup()
|
||||
{
|
||||
TinyWireM.begin();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
expanderWrite(0,HIGH);
|
||||
delay(1000);
|
||||
expanderWrite(0,LOW);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
void expanderWrite(byte pinNumber, boolean state){
|
||||
if(state == HIGH)
|
||||
expanderStatus &= ~(1 << pinNumber);
|
||||
else
|
||||
expanderStatus |= (1 << pinNumber);
|
||||
|
||||
expanderWrite(expanderStatus);
|
||||
}
|
||||
|
||||
void expanderWrite(byte _data ) {
|
||||
TinyWireM.beginTransmission(expander);
|
||||
TinyWireM.send(_data);
|
||||
TinyWireM.endTransmission();
|
||||
}
|
Reference in New Issue
Block a user