Last active
August 28, 2022 15:39
-
-
Save spuder/e3d233bbe68968bd9c499a8fef12e9d9 to your computer and use it in GitHub Desktop.
Revisions
-
spuder revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ void get_input() { if (DigiUSB.available()) { // something to read lastRead = DigiUSB.read(); //If you type 1, it will turnon the LED for 100 ms if (lastRead == '1') { digitalWrite(1,HIGH); delay(100); -
spuder revised this gist
Aug 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ void get_input() { if (DigiUSB.available()) { // something to read lastRead = DigiUSB.read(); # If you type 1, it will turnon the LED for 100 ms if (lastRead == '1') { digitalWrite(1,HIGH); delay(100); -
spuder created this gist
Aug 28, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ Digispark doesn't allow using the normal `Serial.println()` that an arduino uses becuase it doesn't show up as a com port. Instead you need to use `hidapitester` or https://github.com/Bluebie/digiusb.rb ruby app to read from USB data. Digispark has `VID/PID` of `16C0/05DF` ## bluebie/digiusb Start the digterm ruby app and enter `1` in the terminal. When 1 is pressed, the blue LED (pin 1) should turn on for 1/10 of a second ```bash gh repo clone Bluebie/digiusb.rb cd digiusb gem install colored gem intall libusb ./bin/digiterm >hello world >1 ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ // To upload this sketch to digispark, you must either use platform.io or a really old version of arduino on a 32 bit mac (64 bit wont work) // You more than likely can't plug the digispark into a usb 3.0 port. Use a usb 2.0 port or a usb extenstion cable // https://www.youtube.com/watch?v=hVQubqgdoZg // To actually upload code with platform.io, click upload, then unplug/replugin in the device within 5 seconds. #include <Arduino.h> #include <DigiUSB.h> void setup() { pinMode(1, OUTPUT); digitalWrite(1,HIGH); delay(500); digitalWrite(1,LOW); DigiUSB.begin(); } void get_input() { int lastRead; // when there are no characters to read, or the character isn't a newline while (true) { // loop forever if (DigiUSB.available()) { // something to read lastRead = DigiUSB.read(); # If you type if (lastRead == '1') { digitalWrite(1,HIGH); delay(100); digitalWrite(1,LOW); } DigiUSB.write(lastRead); if (lastRead == '\n') { break; // when we get a newline, break out of loop } } // refresh the usb port for 10 milliseconds DigiUSB.delay(10); } } void loop() { // print output DigiUSB.println("Waiting for input..."); // get input get_input(); }