On branch main

Your branch is up to date with 'origin/main'.
Changes to be committed:
	modified:   README.md
	new file:   examples/SIK_Circuit_1A-Blink/SIK_Circuit_1A-Blink.ino
	new file:   examples/SIK_Circuit_1B-Potentiometer/SIK_Circuit_1B-Potentiometer.ino
	new file:   examples/SIK_Circuit_1C-Photoresistor/SIK_Circuit_1C-Photoresistor.ino
	new file:   examples/SIK_Circuit_1D-RGBNightlight/SIK_Circuit_1D-RGBNightlight.ino
	new file:   examples/SIK_Circuit_2A-Buzzer/SIK_Circuit_2A-Buzzer.ino
	new file:   examples/SIK_Circuit_2B-DigitalTrumpet/SIK_Circuit_2B-DigitalTrumpet.ino
	new file:   examples/SIK_Circuit_2C-SimonSays/SIK_Circuit_2C-SimonSays.ino
	new file:   examples/SIK_Circuit_3A-Servo/SIK_Circuit_3A-Servo.ino
	new file:   examples/SIK_Circuit_3B-DistanceSensor/SIK_Circuit_3B-DistanceSensor.ino
	new file:   examples/SIK_Circuit_3C-MotionAlarm/SIK_Circuit_3C-MotionAlarm.ino
	new file:   examples/SIK_Circuit_4A-LCDHelloWorld/SIK_Circuit_4A-LCDHelloWorld.ino
	new file:   examples/SIK_Circuit_4B-TemperatureSensor/SIK_Circuit_4B-TemperatureSensor.ino
	new file:   examples/SIK_Circuit_4C-DIYWhoAmI/SIK_Circuit_4C-DIYWhoAmI.ino
	new file:   examples/SIK_Circuit_5A-MotorBasics/SIK_Circuit_5A-MotorBasics.ino
	new file:   examples/SIK_Circuit_5B-RemoteControlRobot/SIK_Circuit_5B-RemoteControlRobot.ino
	new file:   examples/SIK_Circuit_5C-AutonomousRobot/SIK_Circuit_5C-AutonomousRobot.ino
	new file:   library.properties
	new file:   src/SIK.h
This commit is contained in:
Nicholas Bishop 2025-08-13 14:49:56 -04:00
parent 35e1115a5c
commit 0cf48bdc8d
19 changed files with 1654 additions and 2 deletions

View file

@ -0,0 +1,59 @@
/*
SparkFun Inventors Kit
Circuit 2B-ButtonTrumpet
Use 3 buttons plugged to play musical notes on a buzzer.
This sketch was written by SparkFun Electronics, with lots of help from the Arduino community.
This code is completely free for any use.
View circuit diagram and instructions at: https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-experiment-guide---v41
Download drawings and code at: https://github.com/sparkfun/SIK-Guide-Code
*/
//set the pins for the button and buzzer
int firstKeyPin = 2;
int secondKeyPin = 3;
int thirdKeyPin = 4;
int buzzerPin = 10;
void setup() {
//set the button pins as inputs
pinMode(firstKeyPin, INPUT_PULLUP);
pinMode(secondKeyPin, INPUT_PULLUP);
pinMode(thirdKeyPin, INPUT_PULLUP);
//set the buzzer pin as an output
pinMode(buzzerPin, OUTPUT);
}
void loop() {
if (digitalRead(firstKeyPin) == LOW) { //if the first key is pressed
tone(buzzerPin, 262); //play the frequency for c
}
else if (digitalRead(secondKeyPin) == LOW) { //if the second key is pressed
tone(buzzerPin, 330); //play the frequency for e
}
else if (digitalRead(thirdKeyPin) == LOW) { //if the third key is pressed
tone(buzzerPin, 392); //play the frequency for g
}
else {
noTone(buzzerPin); //if no key is pressed turn the buzzer off
}
}
/*
note frequency
c 262 Hz
d 294 Hz
e 330 Hz
f 349 Hz
g 392 Hz
a 440 Hz
b 494 Hz
C 523 Hz
*/