- connect Arduino to the PC.
- open Arduino IDE.
- open the ArduinoISP example file (File > Examples > ArduinoISP).
- note: if using Arduino Mega, modify the following lines from:
#define RESET 10| from urllib.request import Request, urlopen | |
| import json | |
| class song: | |
| song_id = 0 | |
| name = '' | |
| album = '' | |
| artist = '' | |
| lyrics = '' | |
| tlyrics = '' |
| close all; | |
| num = [0 0 0 0.35]; | |
| den = [1 1.5 0.75 0.125]; | |
| H = tf(num,den) | |
| figure; | |
| bode(H); | |
| figure; |
| #!/usr/bin/python3.5 | |
| import re, sys | |
| SEPARATOR = '\n' | |
| def extract(pattern, in_file_name, out_file_name): | |
| in_file_content = "" | |
| with open(in_file_name, 'r') as in_file: | |
| in_file_content = in_file.read() |
| % demonstrate the beating effect when an analogue signal is sampled | |
| % more on: https://en.wikipedia.org/wiki/Beat_(acoustics) | |
| clc; close all; | |
| %//////////////////// parameters ////////////////////////////////////////// | |
| samp_freq = 8000; % sampling frequency | |
| input_freq = 3800; % input sine wave frequency | |
| num_of_cycles = 15; % number of input cycles to display on graph | |
| x_accu_reso = 100; % input resolution: number per sample points on input |
| #include <iostream> | |
| #include <fstream> | |
| int main() { | |
| std::ifstream is("input.data", std::ios::binary); | |
| std::ofstream os("output.data", std::ios::binary); | |
| char b[2]; | |
| ushort x, px, c = 0; | |
| ushort ct = 2; // num. of repeated data to be written out | |
| if(is) { |
| // Arduino UNO | |
| // faster digital read and write using register and bit mask | |
| #define FAST_DIGITAL_READ(REG, MASK) (*REG & MASK) != 0; | |
| #define FAST_DIGITAL_WRITE(REG, MASK, VAL) (VAL == LOW) ? (*REG &= ~MASK) : (*REG |= MASK); | |
| // pin definition | |
| #define OUTPUT_PIN 13 | |
| #define INTERRUPT_PIN 2 |
| # rename MP3 files based on metadata (named artist and title) | |
| # copy this script in the same directory as the MP3 files and run | |
| # renamed MP3 are copied to renamed/ | |
| mkdir renamed; | |
| for f in *.mp3; do | |
| TITLE=`ffmpeg -i "$f" 2>&1 | grep title | sed "s/ \+title \+: //"`; | |
| ARTIST=`ffmpeg -i "$f" 2>&1 | grep artist | sed "s/ \+artist \+: //"`; | |
| TRACK=`ffmpeg -i "$f" 2>&1 | grep track | sed "s/ \+track \+: //"`; | |
| ZERO_TRACK=$(printf %02d ${TRACK}); # zero-padded track number |
| import os | |
| os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID' | |
| os.environ['CUDA_VISIBLE_DEVICES'] = '0' # -1 = no GPU | |
| import tensorflow as tf | |
| import tensorflow.keras as keras | |
| # versions | |
| print('tf version: {}'.format(tf.__version__)) | |
| print('keras version: {}'.format(keras.__version__)) |
| ;;;;;;;;;; start script | |
| G21 ; set unit to mm | |
| G90 ; set to absolute positioning | |
| M82 ; set extruder to absolute mode | |
| M107 ; fans off | |
| G28 X0 Y0; home X and Y axes | |
| G28 Z0 ; home Z axis | |
| G1 Z15 F300 ; move to (0, 0, 15) | |
| G92 E0 ; set new extruder position to 0 | |
| G1 F140 E29 ; extrude 29mm of material |