Press the flip flop key for the j / k code.
At the beginning we define variables for our program. We see that: To create a variable you must use the command
"int_name = port; ». IT IS ALWAYS WRITTEN FROM" installation blank () ".
We then define which doors will be the entrances and the exits.
"PinMode (name, OUTPUT / INPUT)"
After pressing the jk flip flop code, it concludes with "void loop ()".
j = digital identification (button);
if ((j == HIGH) && (k == LOW)) {
clk = 1-clk;}
k = j;
if (clk == 1) {digital writing (led, HIGH);
else {digitalWrite (led, LOW);
}}
In this project we will look at key commands and key components used in the Arduino. We use a buzzer, 3 led, a button in our case with a touch sensor. We also use a Liquid Crystal which is the Arduino screen. First we will see how we can do the basics like giving the command to open 1 Led. Initially for my convenience I will set some parameters by quoting the shot that analog or digital will use. This procedure was also explained before reference (row 5) 'int_onoma = port; ». The process of defining the variable necessarily takes place over the installation gap.
Next to the setting we specify via the pinMode command whether the slot we are using is essentially an input or an output (OUTPUT / INPUT)
E.g. pinMode (led, OUTPUT);
In our example of this we combine it with the application of the JK flip flop, essentially the switch.
By default, if we give our application Terms and Conditions that will open the led. In the simplest case we can use a button with the following code.
button int = 2.
int led = 1.
int x = 0;
void set () {
pinMode (button, ENTER);
pinMode (led, OUTPUT);
}
empty loop () {
x = digital identification (button);
if (x == 1) {digitalWrite (led, HIGH)?}
otherwise {digitalWrite (led, LOW)}
}
}
Temperature sensor LM35To be able to use this sensor we need to understand the wiring, which must be received to receive an output signal (mV). From the manufacturer I know that: 1) it is the power supply (Vcc = 5 / 3V), 2) it is the analog output gate (output 10mV / C), 3) ground (GND).If it properly connects the sensor listens to the code.
int tempPin = 1;
Serial.print ("TEMPRATURE =");
int m = 0;
Serial.print (cel);
void install ()
{
{Serial.print ("* C");
Serial.begin (9600);
Serial.println ();
}
delay (1000);
empty loop ()
{
}
m = analogRead (tempPin);
float mv = (m / 1024.0) * 5000;
float cel = mv / 10;
LiquidCrystalIt is widely used for placing low-speed IC peripherals on processors and microcontrollers for on-road and off-road communication.
The I2C uses only two open collector open or drain lines, the Serial Data Line (SDA) and the Serial Clock (SCL), with resistors pulled. Typical voltages used are +5V or +3.3V. The I2C reference scheme has 7 address addresses, with a 10 bit bit extension being used. The usual I2C bus speeds are 100 kbit / s standard and 400 kbit / s fast.
Connecting the LCD screen to the microcontrollerUsing this I2C technique, we can operate our LCD screen to display data from our sensors or any text from the microcontroller using only 2 pins, ie SCL (which is pin clock) and SDA (which is pin pin) use the other 2 pins for power supply. i.e. Vcc and Gnd.
steps
1. Connect the SCL and SDA data SCL and SDA pin to your microcontroller, (if you do not know which terminal is SCL and which is the SDA, check the pin-out data sheet) so for this tutorial you will use a microcontroller ARDUINO UNO, which has SCL as A5 pin, SDA pin as A4.) 2. Connect 5V to 5V, and Gnd to the arduino pin ground. 3. Adjust the LCD screen contrast using the cartridge on the back of the LCD unit.
Finding the HexaDecimal address of the I2C LCDWe can connect to multiple I2C devices at the same time, but to distinguish between devices, the HEX hex address is allocated to each of the I2Cs, which we need to know before proceeding further.
To find out this address,
1. Connect the I2C device to the Arduino Uno, (Follow the previous step).
2. Download the attachment code and upload to your IDE.
3. Open Serial Moniter, which will return the Hex address of the I2C Connected device.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd (0x3F, 16.2);
void setup ()
{
lcd.init (); // initialize the lcd
lcd.init ();
// Print a message
Photos during the process :
Comments
Please log in or sign up to comment.