This commit is contained in:
Fatima Idrees 2025-08-02 11:05:05 +03:00
parent f2a25bf54b
commit 360ee7e80b
9 changed files with 55 additions and 29 deletions

View File

@ -31,7 +31,7 @@ Digital sensors detect clear changes (like pressing a button), while digital out
![](../Images/25.png)
This sensor reads the input from the physical world.
This sensor detects when it is touched. It sends an ON signal when touched and OFF when released.
---
@ -43,19 +43,19 @@ This sensor reads the input from the physical world.
![](../Images/21.png)
This sensor reads the input from the physical world.
This sensor detects when the button is pressed. It sends an ON signal while the button is held down.
---
### Module 03: Photo Interrupter
![Image](../Images/.png)
![](../Images/34.png)
#### Block:
![](../Images/23.png)
This sensor reads the input from the physical world.
This sensor detects if something passes between its light beam. It is commonly used to count or detect movement.
---
@ -67,7 +67,7 @@ This sensor reads the input from the physical world.
![](../Images/24.png)
This sensor reads the input from the physical world.
This sensor detects tilt or angle changes. It sends an ON signal when tilted beyond a certain point.
---
@ -79,9 +79,13 @@ This sensor reads the input from the physical world.
![](../Images/26.png)
This block reads the **temperature** from the environment.
#### Block 2:
![](../Images/26.png)
![](../Images/27.png)
This block reads the **humidity** (moisture in the air).
---
@ -93,10 +97,14 @@ This sensor reads the input from the physical world.
![](../Images/29.png)
This block turns the LED ON or OFF using a **true/false** value.
#### Block 2:
![](../Images/32.png)
This block adjusts the LED brightness by entering a value between **0 and 1023**.
---
### Module 07: Buzzer
@ -107,19 +115,24 @@ This sensor reads the input from the physical world.
![](../Images/28.png)
This block turns the buzzer ON or OFF using a **true/false** value.
#### Block 2:
![](../Images/31.png)
This block changes the buzzers sound level using a value between **0 and 1023**.
---
### Module 08: Relay
![Image](../Images/.png)
![](../Images/33.png)
#### Block:
![](../Images/30.png)
This block controls the relay like a switch—**ON or OFF**—allowing you to turn other devices on or off through the relay.
---

View File

@ -1,13 +1,10 @@
module Spark_I2C 'cat;Output'
author FABLAB
version 1 1
depends '_Gesture (PAJ7620)'
choices direction clockwise 'counter-clockwise'
description ''
variables Gesture
spec 'r' 'Gesture Read' 'Gesture Read'
space
spec ' ' 'Motor Driver A' 'Motor Driver A Direction _ Speed _' 'menu.direction num' 'clockwise' 10
spec ' ' 'Motor Driver B' 'Motor Driver B Direction _ Speed _' 'menu.direction num' 'clockwise' 10
spec 'r' '_Direction' '_Motor Direction _' 'menu.direction' '10'
@ -20,10 +17,6 @@ to Direction Direction {
}
}
to 'Gesture Read' {
return ('paj7620 read')
}
to 'Motor Driver A' Direction Speed {
if ((Direction Direction) == (booleanConstant true)) {
i2cSet 0 1 Speed

View File

@ -1,7 +1,6 @@
module Spark_PWM 'cat;Control'
author 'FABLAB BH'
version 1 1
depends _Servo
choices PWM_pins '1' '9'
choices PWM_pins2 '3' '4' '6' '7' '8'
choices direction clockwise 'counter-clockwise'
@ -16,9 +15,7 @@ description ''
space
spec ' ' 'Fan Motor' 'Fan Motor Pin _ Direction _ Speed _ (0-100)' 'menu.PWM_pins menu.direction num' 1 'clockwise' 50
spec ' ' 'Fan Motor2' 'Fan Motor Pin _ Direction _ Speed _ (0-1023)' 'menu.PWM_pins menu.direction num' 1 'clockwise' 50
space
spec ' ' 'Servo' 'Servo Motor Pin _ Speed _ (-100 to 100)' 'menu.servo_pins num' 33 50
spec ' ' 'Servo Motor Pin' 'Servo Motor Pin _ Degrees _ (-90 to 90)' 'menu.servo_pins num' 33 90
to Direction Direction {
if (Direction == ('[data:toString]' 'counter-clockwise')) {
@ -91,12 +88,3 @@ to 'Fan Motor4' Pin Speed {
to 'PWM Pin' Pin {
return (at Pin ('[data:makeList]' 13 0 26 27 0 23 16 5 18))
}
to Servo Pin Speed {
setServoSpeed Pin Speed
}
to 'Servo Motor Pin' Pin Degrees {
setServoAngle Pin Degrees
}

32
I2C/README.md Normal file
View File

@ -0,0 +1,32 @@
# 🟦 I2C
### What is I2C?
I2C (Inter-Integrated Circuit) is a communication protocol that allows multiple sensors and modules to connect using just **two wires**—one for data (SDA) and one for clock (SCL).
Its especially useful for connecting devices like screens, motor drivers, or environmental sensors that need to **send and receive data**.
---
### Included Modules:
- [Motor Driver](#module-01-motor-driver)
---
### Module 01: Motor Driver
![Image](../Images/.png)
#### Block A:
![](../Images/35.png)
This block is used to control **Motor A**.
#### Block B:
![](../Images/36.png)
This block is used to control **Motor B**.
---

BIN
Images/33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
Images/34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
Images/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
Images/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -66,7 +66,7 @@ Some modules had more than one function (like color + brightness), making it tri
|------------------------|--------------------|----------------------------------|--------------------------|----------------------------------|
| LED | Film Pressure | OLED Display (Copied) | Fan Motor | Ultrasonic (Dependencies) |
| Buzzer | Photoresistor | Motor Driver | Servo (Dependencies) | RGB LED |
| Horn | Potentiometer | Gesture Sensor (Dependencies) | — | Traffic Light |
| Horn | Potentiometer | | — | Traffic Light |
| Touch Sensor | Steam Sensor | — | — | — |
| Button Input | — | — | — | — |
| Photo Interrupter | — | — | — | — |