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 characters
#define NOTE_A0 27 | |
#define NOTE_AS0 29 | |
#define NOTE_B0 31 | |
#define NOTE_C1 33 | |
#define NOTE_CS1 35 | |
#define NOTE_D1 37 | |
#define NOTE_DS1 39 | |
#define NOTE_E1 41 | |
#define NOTE_F1 44 | |
#define NOTE_FS1 46 |
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 characters
# uploads code.py automatically to CircuitPython device on Windows | |
import subprocess | |
import shutil | |
# update SOURCE to be the file you want to upload to drive | |
SOURCE = "C:/Users/Michael/Documents/GitHub/CircuitPython_playground/code.py" | |
# main function | |
def main(): |
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 characters
# Windows setup | |
# pip3 install python-docx | |
# pip3 install pypdf2 | |
# pip3 install docx2pdf | |
# linux setup | |
# sudo apt install unoconv | |
# pip3 install python-docx | |
# pip3 install pypdf2 | |
import datetime |
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 characters
import subprocess | |
import socket | |
# get ip address | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect(("8.8.8.8", 80)) | |
IP = s.getsockname()[0] | |
# use nmap and get response | |
cmd = f"sudo nmap -sn {IP}/24" |
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 characters
// function to retrieve distance from ultrasonic sensor | |
// distance provided as an integer value in inches | |
// EXP. int dist_in = get_distance(); | |
// update macros names for ultrasonic sensor pins | |
// in this case, I used TRIG_PIN, ECHO_PIN | |
int get_distance() { | |
// send trigger pulse by setting it high for 10 us | |
digitalWrite(TRIG_PIN, HIGH); | |
delayMicroseconds(10); |
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 characters
/* | |
* #define macros for the codes | |
* for each button on IR remote. | |
*/ | |
#define IR_FORWARD 0xFF629D | |
#define IR_REVERSE 0xFFA857 | |
#define IR_LEFT 0xFF22DD | |
#define IR_RIGHT 0xFFC23D | |
#define IR_OK 0xFF02FD |
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 characters
# ask for input | |
number = int(input("Please enter an 8-bit binary number: ")) | |
# extract each bit | |
bit0 = number % 10 | |
bit1 = number % 100 // 10 | |
bit2 = number % 1000 // 100 | |
bit3 = number % 10000 // 1000 | |
bit4 = number % 100000 // 10000 | |
bit5 = number % 1000000 // 100000 |
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 characters
#define REST 0 | |
#define NOTE_A0 27 | |
#define NOTE_AS0 29 | |
#define NOTE_B0 31 | |
#define NOTE_C1 33 | |
#define NOTE_CS1 35 | |
#define NOTE_D1 37 | |
#define NOTE_DS1 39 | |
#define NOTE_E1 41 | |
#define NOTE_F1 44 |
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 characters
/* | |
Create new file called images.h. | |
Copy the Arduino/C code variables to the right of the matrix picture. | |
Paste the code into the images.h file | |
https://github.com/xantorohara/led-matrix-editor | |
http://xantorohara.github.io/led-matrix-editor/ | |
https://xantorohara.github.io/led-matrix-editor/#003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|00007e99997e0000|000000ffff000000|000000ffff000000|00007e99997e0000|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|003c429999423c00|00007e99997e0000|000000ffff000000|000000ffff000000|00007e99997e0000|003c429999423c00|003c429999423c00|00007e99997e0000|000000ffff000000|000000ffff000000|00007e99997e0000 |
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 characters
# ping router every 5 minutes, reconnect if fails | |
*/5 * * * * /usr/bin/sudo /home/pi/Documents/reconnect_wlan0.sh > /dev/null |