Skip to content

Commit 14fe0b1

Browse files
committed
better texts
1 parent e68d98c commit 14fe0b1

2 files changed

Lines changed: 27 additions & 42 deletions

File tree

led and button (1)/LedAndButton.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
int button = 3;
22

3-
//add many LEDs as you like
43

54
int LED1 = 10;
6-
// int LED2 = 11
5+
// use the pin number that your led is pluged into
76

87
void setup()
98
{
10-
Serial.begin(115200);
9+
Serial.begin(9600);
1110
pinMode(button, INPUT_PULLUP); // set the button as input
1211
pinMode(LED1, OUTPUT); // and set the LED as output
1312

led and button (1)/project1.md

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,41 @@
1-
# Button and led
1+
# Button and LED Basics with Arduino
22

3-
in this project you will learn the basics of `arduino`.
4-
simulate the project at [led and button](https://wokwi.com/projects/411336385024901121) at wowki .
5-
and don't forget to like ❤️
3+
This project introduces the fundamental concepts of Arduino,
64

5+
You can simulate this project online using Wokwi: [Button and LED Simulation](https://wokwi.com/projects/411336385024901121)
76

7+
If you find this helpful, please consider giving it a like ❤️!
88

9-
## what you will learn
10-
1. declaring variables
11-
2. reading and writing pins
12-
3. using the serial monitor
9+
## What You Will Learn
1310

14-
# Diagram
15-
diagram of the .ino project.
16-
![Screenshot_20241010_115241_Chrome](https://github.com/user-attachments/assets/6bb95536-b864-4568-97d8-5654944a87fb)
11+
This project will guide you through the following essential Arduino concepts:
1712

18-
## more about the code
13+
1. **Declaring Variables:** Learn how to create and use variables in your Arduino sketches.
14+
2. **Reading Digital Input:** Understand how to read the state of a digital input pin connected to a button.
15+
3. **Writing Digital Output:** Learn how to control a digital output pin connected to an LED.
16+
4. **Using the Serial Monitor:** Discover how to use the Serial Monitor for debugging and displaying information.
1917

20-
### serial monitor
21-
a serial monitor mainly used for debging code and printing text
18+
## Project Diagram
19+
Circuit setup:
2220

21+
![Button and LED Diagram](https://github.com/user-attachments/assets/6bb95536-b864-4568-97d8-5654944a87fb)
2322

23+
## Code
2424

25-
```
26-
Serial.begin(9600)
27-
```
28-
this code will to start the serial monitor. it has to be in the
29-
`setup()` function.
30-
31-
32-
To print something in the serial monitor use the `Serial.print()` function.
33-
the code will be something like this:
34-
35-
``` cpp
36-
void setup() {
37-
Serial.begin(9600);
38-
Serial.print("cool");
39-
}
40-
```
41-
42-
_*NOTE*_: `Serial.print()` will print in the same line and `Serial.printnl()` will print on a new line.
43-
44-
25+
Let's dive deeper into the code elements:
4526

27+
### Serial Monitor
4628

47-
### Pinmode (input and output)
48-
To turn on a led or check if a button is pressed or not we use inputs and outputs. ***Outputs*** are LED, screen, buzzer's. And ***Inputs*** are buttons, switches, etc
29+
The Serial Monitor is an tool for debugging your Arduino code and displaying text information from your board to your computer.
4930

50-
to set a pin as a input/output we use `pinMode()` function.
5131
```cpp
52-
pimMode(pin_number, Value) //value can be Input or Output
53-
// and pin_number will be the number of the pin that the input/output is plugged into
32+
Serial.begin(9600);
5433
```
34+
by using the code given, we can set up serial communication. it's recommended to run it inside of the ***setup*** function as it's only need to be run once:
5535

36+
```cpp
37+
void setup()
38+
{
39+
Serial.begin(9600);
40+
}
41+
```

0 commit comments

Comments
 (0)