Compare commits
3 Commits
619ff4612b
...
2b158dad7b
Author | SHA1 | Date | |
---|---|---|---|
2b158dad7b | |||
02b166a732 | |||
0a395e29dd |
16
Buzzer.ubl
16
Buzzer.ubl
@ -1,16 +0,0 @@
|
|||||||
module Buzzer
|
|
||||||
author unknown
|
|
||||||
version 1 0
|
|
||||||
description ''
|
|
||||||
|
|
||||||
spec ' ' 'Buzzer' 'Buzzer Pin _ State _' 'auto bool' 5 true
|
|
||||||
spec ' ' 'Buzzer2 Pin' 'Buzzer Pin _ Note _' 'auto auto' 5 1000
|
|
||||||
|
|
||||||
to Buzzer Pin State {
|
|
||||||
digitalWriteOp Pin State
|
|
||||||
}
|
|
||||||
|
|
||||||
to 'Buzzer2 Pin' Pin Note {
|
|
||||||
analogWriteOp Pin Note
|
|
||||||
}
|
|
||||||
|
|
BIN
Images/5.png
Normal file
BIN
Images/5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
Images/6.png
Normal file
BIN
Images/6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
16
README.md
16
README.md
@ -1,13 +1,13 @@
|
|||||||
# Buzzer Library for MicroBlocks
|
# Buzzer Library for MicroBlocks
|
||||||
|
|
||||||
Welcome to the **Buzzer Library** for MicroBlocks!
|
Welcome to the **Buzzer Library** for MicroBlocks!
|
||||||
This library makes it easy for anyone—even if you don’t know how to code or use a computer much—to control a fan motor using simple blocks in MicroBlocks.
|
This library makes it easy for anyone—even if you don’t know how to code or use a computer much—to control a buzzer using simple blocks in MicroBlocks.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Easy drag-and-drop blocks** for controlling your fan motor
|
- **Easy drag-and-drop blocks** for controlling your buzzer
|
||||||
- **No coding required**
|
- **No coding required**
|
||||||
- **Turn on & off the buzzer**
|
- **Turn on & off the buzzer**
|
||||||
- **Control the notes**
|
- **Control the notes**
|
||||||
@ -20,14 +20,14 @@ This library makes it easy for anyone—even if you don’t know how to code or
|
|||||||
**What you need:**
|
**What you need:**
|
||||||
- Spark microcontroller and connecting wires
|
- Spark microcontroller and connecting wires
|
||||||
- MicroBlocks IDE installed ([Download here](https://microblocks.fun/download/))
|
- MicroBlocks IDE installed ([Download here](https://microblocks.fun/download/))
|
||||||
- A fan motor and basic connecting wires
|
- A buzzer and basic connecting wires
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. **Download the Fan Motor Library:**
|
1. **Download the buzzer Library:**
|
||||||
Download the library file from [here](Buzzer.ubl).
|
Download the library file from [here](Spark_Digital.ubl).
|
||||||
|
|
||||||
2. **Open MicroBlocks IDE** on your computer.
|
2. **Open MicroBlocks IDE** on your computer.
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ This library makes it easy for anyone—even if you don’t know how to code or
|
|||||||
- Turn Buzzer On and Off
|
- Turn Buzzer On and Off
|
||||||
- Change Note"
|
- Change Note"
|
||||||
|
|
||||||
5. **Click the green flag** or “Run” to start controlling your fan!
|
5. **Click the green flag** or “Run” to start controlling your buzzer!
|
||||||
|
|
||||||
---
|
---
|
||||||
## Example Project
|
## Example Project
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
After setting the pin value, there are two ways to use a buzzer:
|
After setting the pin value, there are two ways to use a buzzer:
|
||||||
|
|
||||||
@ -79,5 +79,5 @@ After setting the pin value, there are two ways to use a buzzer:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Have fun building with your Buzzer!*
|
*Have fun building with your fan motor!*
|
||||||
|
|
||||||
|
46
Spark_Digital.ubl
Normal file
46
Spark_Digital.ubl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
module Spark_Digital 'cat;Data'
|
||||||
|
author 'Fatima Idrees'
|
||||||
|
version 1 0
|
||||||
|
description ''
|
||||||
|
|
||||||
|
spec ' ' 'Buzzer' 'Buzzer Pin _ Tone _' 'num num' 5 1000
|
||||||
|
spec ' ' 'Buzzer2' 'Buzzer Pin _ State _' 'auto bool' 5 false
|
||||||
|
spec ' ' 'LED' 'LED Pin _ State _' 'num bool' 18 false
|
||||||
|
spec ' ' 'LED2 Pin' 'LED Pin _ Brightness _' 'num auto' 18 1000
|
||||||
|
spec 'r' 'Button Pin' 'Button Pin _' 'auto' 27
|
||||||
|
spec 'r' 'Inverted Button Pin' 'Inverted Button Pin _' 'auto' 27
|
||||||
|
|
||||||
|
to 'Button Pin' Input {
|
||||||
|
local 'Read1' (digitalReadOp Input 'up')
|
||||||
|
if (Read1 == (booleanConstant true)) {
|
||||||
|
return (not Read1)
|
||||||
|
} else {
|
||||||
|
return (booleanConstant true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to Buzzer Pin Tone {
|
||||||
|
analogWriteOp Pin Tone
|
||||||
|
}
|
||||||
|
|
||||||
|
to Buzzer2 Pin State {
|
||||||
|
digitalWriteOp Pin State
|
||||||
|
}
|
||||||
|
|
||||||
|
to 'Inverted Button Pin' Input {
|
||||||
|
local 'Read2' (digitalReadOp Input 'up')
|
||||||
|
if (Read2 == (booleanConstant false)) {
|
||||||
|
return Read2
|
||||||
|
} else {
|
||||||
|
return (booleanConstant true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
to LED Pin State {
|
||||||
|
digitalWriteOp Pin State
|
||||||
|
}
|
||||||
|
|
||||||
|
to 'LED2 Pin' Pin Brightness {
|
||||||
|
analogWriteOp Pin Brightness
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user