Skip to content

Instantly share code, notes, and snippets.

View billykwok's full-sized avatar
🎯
Focusing

Billy Kwok billykwok

🎯
Focusing
View GitHub Profile
#include <Servo.h>
#define PIN_SERVO_ARM 10
#define PIN_SERVO_STAGE 9
#define ANGLE_COLLAPSE 105
#define ANGLE_EXPAND 0
Servo servoArm;
Servo servoStage;
#include <Servo.h>
#define PIN_SERVO_FRONT 9
#define PIN_SERVO_BACK 10
#define PIN_POT A0
Servo servoFront;
Servo servoBack;
enum State { REST, FRONT_LEFT, FRONT_RIGHT, BACK_LEFT, BACK_RIGHT };
#define PIN_MOTOR 9
#define PIN_PIEZO 10
#define PIN_BIT0 A0
#define PIN_BIT1 A1
#define PIN_BIT2 A2
#define PIN_BIT3 A3
#define PIN_BIT4 A4
#define PIN_BIT5 A5
const long FREQS[64] = {
#include "CapacitiveSensor.h"
#include "Volume3.h"
#include "pitches.h"
#define SAMPLE_SIZE 10000
#define THRESHOLD_10M 5000
#define THRESHOLD_1M 800
#define NOTE_DURATION 200
const int PITCH_G[7] = {NOTE_G1, NOTE_G2, NOTE_G3, NOTE_G4,
#define HB A0
#define PS A1
#define LED 9
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop() {
#define BAUD_RATE 9600
#define DELIMITER '\n'
#define LED_RED 9
#define LED_GREEN 10
#define LED_BLUE 11
#define POT_H A2
#define POT_S A1
#define POT_L A0
#define BAUD_RATE 9600
#define SAMPLING_RATE 100
#define LED_RED 9
#define LED_GREEN 10
#define LED_BLUE 11
#define POT_SPEED A3
#define POT_RED A2
#define POT_GREEN A1
import SerialPort from 'serialport';
import readline from 'readline';
const STEP = 20;
const rgb = [0, 0, 0];
(async () => {
// Scan for any Arduino device.
const entries = await SerialPort.list();
const entry = entries.find(
#define BAUD_RATE 9600
// #define LED_RED 9
// #define LED_GREEN 10
// #define LED_BLUE 11
uint8_t rgb[3];
void setup() {
// pinMode(LED_RED, OUTPUT);
import SerialPort from 'serialport';
import readline from 'readline';
(async () => {
const entries = await SerialPort.list();
const entry = entries.find(
(it) => it.manufacturer && it.manufacturer.includes('Arduino')
);
if (!entry) {
console.warn('No Arduino found');