Pada artikel kali ini akan di bahas cara membuat lampu lalu lintas dengan sedrhana menggunakan arduino uno
untuk bahan yang dibutuhkan yaitu :
Arduino Uno
LED merah, kuning, hijau
Resistor (untuk membatasi arus pada LED)
Kabel (untuk menghubungkan komponen)
Kabel USB untuk menghubungkan Arduino ke komputer
Rangkaian bisa di lihat dibawah ini
Hubungkan kaki anoda (kaki yang lebih panjang) LED merah, kuning, hijau ke resistor kemudian dari resistor hubungkan ke pin digital pada Arduino (misalnya pada gambar terletak pada Pin 9,8,7).
Hubungkan kaki katoda (kaki yang lebih pendek) LED ke Pin GND Arduino
Upload program dibawah ini
void setup() {
pinMode(9, OUTPUT); // LED Merah
pinMode(8, OUTPUT); // LED Kuning
pinMode(7, OUTPUT); // LED Hijau
}
void loop() {
digitalWrite(9, HIGH); // Nyalakan LED Merah
delay(10000); // Tunda selama 10 detik
digitalWrite(9, LOW); // Matikan LED merah
digitalWrite(8, HIGH); // Nyalakan LED Kuning
delay(10000); // Tunda selama 10 detik
digitalWrite(8, LOW); // Matikan LED Kuning
digitalWrite(7, HIGH); // Nyalakan LED Hijau
delay(10000); // Tunda selama 10 detik
digitalWrite(7, LOW); // Matikan LED Hijau
}
led akan hidup bergantian selama 10 detik tiap led, bisa kalian ubah dengan mengubah delay pada program
pada artikel kali ini akan dibahas bagaimana cara mengggunakan program milis pada relay, sehingga kinerja relay bisa berbarengan dengan lainnya, untuk bahan yang diperlukan yaitu
arduino uno
modu relay
kabel jumper
keterangan :
VCC pada modul relay hubungkan ke 5v pada arduino
GND pada modul relay hubungkan ke GND pada arduino
Pertama untuk menggunakan sensor suhu DS18B20 waterproof dengan arduino uno yaitu perlu menyiapkan beberapa komponen berikut ini :
arduino uno
sensor suhu DS18B20 waterproof
resistor 4.7k ohm
kabel secukupnya
berikutnya lihat rangkaian pada gambar dibawah ini dan ikuti dengan persis
download library terlebih dahulu pada arduino ide dengan cara masuk ke menu sketch > include library > manage libraries... kemudian cari pada kotak pencarian seperti pada gambar berikut ini
pertama cari dengan nama OneWire kemudian instal, dan berikutnya cari lagi dengan nama DallasTemperature
kemudian copy program dibawah ini dan lihat hasilnya pada serial monitor arduino ide
Pertama copy program diatas kemudian lihat pada serial monitor pada arduino ide
uji coba sensor ke air bersih dan lihat berapa nilai analog sensor yang terbaca pada serial monitor
kemudian buat program mapping, pada kali ini nilai analog sensor dibatasi dari 0 - 100 dilihat pada program dibawah ini yang diberi warna merah, untuk 420 merupakan nilai analog paling tinggi saat mendeteksi air bersih, jadi ubah nilai 420 sesuai nilai analog sensor yang terbaca saat dicelupkan ke air bersih, program lengkapnya dapat dilihat dibawah ini :
Pada artikel ini akan dijelaskan bagaiaman cara menggunakan sensor turbidity atau sensor kekeruhan air dengan menggunakan arduino uno, langsung saja ikuti langkah berikut ini
pertama yang perlu disoapkan yaitu :
Sensor Turbidity/ Kekeruhan
Arduino Uno
Kabel Jumper Secukupnya
berikutnya rangkaian dapat dilihat dibawah ini
pada gambar diatas digunakan pin analog untuk membaca data yang diterima oleh sensor
Artikel kali ini membahas mengenai cara upload coding pada ESP32 CAM. Seperti yang sudah disebutkan pada artikel sebelumnya bahwa ESP32-CAM tidak mempunyai port khusus seperti mikrokontroler yang mempunyai port Micro USB untuk upload program, dengan demikian maka diperlukan perangkat tambahan supaya dapat melakukan upload program ke board ESP32-CAM. Perangkat tambahan yang dapat digunakan yaitu FTDI FT232RL. FTDI memiliki fungsi yang sama seperti port untuk disambungkan dengan USB. dibawah ini merupakan gambar rangkaiannya.
Keterangan :
ESP32-CAM > FTDI
GND dihubungkan ke GND
5V dihubungkan ke VCC (5V)
U0R dihubungkan ke TX
U0T dihubungkan ke RX
GPIO 0 dihubungkan ke GND
Setelah semua terhubung maka sebelum upload program instal terlebih dahulu USB driver dari FTDI
CSS stands for Cascading
Style Sheet, which is an arrangement of code that we use to set how HTML
documents will be displayed. What is meant by setting here is: changing the
color, layout, border, shadow, position, background, and so on.
In fact, all web pages in
this era almost certainly use CSS.
Inserting CSS in HTML
There are 3 ways to add CSS
to HTML:
Using inline CSS.
Using internal CSS.
and Using external CSS.
Using inline CSS
Inline CSS is a CSS code
that we embed in any element in the HTML body, directly using the attribute style
Example
<button>Log
In</button>
<button>Register</button>
Output:
We can change the style of
the two buttons above by adding attributes style
Among the important features
of HTML are: form tags. That is a tag that we use to collect input from users,
this concept is the same as the concept of forms in the real world.
Generally, a website always
has a form feature, the most common examples we often encounter are:
login form
sign-up form
comment form on a blog /
media
Element <form>
The most important is the
tag or element <form>. It is a wrapping tag or container that represents
a “form” where one form can have multiple fields.
<form>
...........
</form>
The <form> tag itself
does not have any appearance or is invisible to the naked eye, but we still
have to define it so that the form we create can work properly.
Elemen <input>
In HTML, there are many
types of input models ranging from text, files, checklists, and so on which,
God willing, we will discuss in more detail in the next few meetings.
And most of these types of
fill models use <input> tags.
Example
<input
type="text" name="name" value="joe">
Output :
The input tag has 2 basic
attributes, namely:
type
and names.
The type attribute is used
to define the type of the field, while the name attribute is the name of the
field.
Several types of input tag
input types such as text (default), radio, checkbox, submit, button and so on:
<input
type="text">
<!-- choice (a, b,
c, d) -->
<input
type="radio">
<!-- type ceklis
-->
<input
type="checkbox">
<!-- button for
submit -->
<input
type="submit">
<!-- button not
for submit -->
<input
type="button">
Text Field
The first is a text field,
it is an input tag with a type="text" attribute that functions to collect
text fields from the user.
Even without writing
type="text", the default type of an input is text.
In the code above, we use
the <div> element to wrap the <label> and <input> elements.
The use of the <div> element here only works so that the label and input
are displayed in a new line, so even without using a <div> is fine.
One more thing, because the
<label> and <input> elements are inline elements, we must use a
"certain way" (such as using the <br> tag) so that the label
and input are displayed on a new line.
If you don't use div or br
(as in the example below):
Take a look at the HTML code
above: we have two <label> elements.
The <label> element
does look like a typical <span> element, but it has a special function:
to label an input field.
Because when a screen reader
reads the content of an HTML page, then finds an input, it will read the
corresponding label.
Another function of the
<label> tag is: when we click on a label, the browser will put focus on
the field associated with it.
We can associate an
<label> and an <input> with the for attribute for the label, and
the id attribute on the <input> with the exact same value.
Consider the following
example:
<label
for="input-name">Name</label>
<br>
<br>
<input
id="input-name">
In the code above, the
<input> element has an id of name-field, and the label element has a for
attribute with the same value, namely name-field.
Output :
Radio Button
Next is the field with the
radio type. It is an option type field where we can offer several options to
the user. However, only one option can be selected.
Example
<form>
Gender: <br>
<div>
<input id="ml"
type="radio" name="gender_">
<label
for="ml">Male</label>
</div>
<div>
<input id="fl"
type="radio" name="gender_">
<label
for="fl">female</label>
</div>
</form>
Output:
In the options above, we can
only choose one of each.
The thing to note is that
the name attribute of each radio button must have the same value in a set of
options. In the example above, we have gender_
Check boxes
Next is the checkbox or
checklist. The difference with radio, we can choose more than one option in a
set of options.
Let's change all
type="radio" in the previous code to type="checkbox".
<form>
Gender: <br>
<div>
<input id="ml" type="checkbox"
name="gender_">
<label for="ml">Male</label>
</div>
<div>
<input id="fl" type=" checkbox
" name="gender_">
<label
for="fl">female</label>
</div>
</form>
Output :
In the example above we can
select (tick) all the available options.
Element button submit
The next input element that
we will discuss in this form introduction is input type submit.
It is an <input>
displayed in the form of a button. If this input is clicked, the form will be
submitted and the browser will start sending data.
Example :
<form>
<input type="text" name="name"
value="Joe"> <br>
<input type="submit"
value="Submit">
</form>
output :
We can also use element
<button>
<form>
<input type="text" name="name"
value="joe"> <br>
<button>Submit</button>
</form>
Buttons that are in a form
will automatically be considered type="submit". If we want to create
a plain button that doesn't submit <form>, we can add the attribute
type="button"
In the code above, when the
"Save" button is clicked, it will not submit the form because it is
of type normal button (type="button"), not submit type
How to Process the Form
When a <form> is
submitted, using either a <button> element or an <input
type="submit">, the browser will send the data to the URL defined
in the action attribute in the form tag.
Meanwhile, if the action
attribute is not defined, the browser will use the current URL as the
destination for sending data.
Example :
<form action="/
process-registration ">
...
</form>
In the example above, when
the form is submitted, the browser will send the existing data to the URL
/process-registration
Array merupakan kumpulan
dari beberapa variable yang memiliki nama serta tipe data yang sama, atau
pengelompokan dengan data atau dama yang sama
Contoh hasil program array
Input : arr [] = {2,3,4}
Output : 9
2 + 3 + 4 = 9
Contoh program array
menggunakan python dengan Iterasi melalui array dan menambahkan setiap elemen ke
variabel jumlah dan menampilkan hasilnya.
[program 1]
#Program untuk menemukan jumlah elemen
#dalam array yang diberikan
def _sum(arr):
sum = 0
for i in arr:
sum = sum + i
return(sum)
arr = []
arr = [15, 4, 9, 12]
n = len(arr)
ans = _sum(arr)
print('Sum of the array is ', ans)
output :
hasil jumlah array 40
cara kedua yaitu menggunakan
fungsi sum(), sum() merupakan fungsi bawaan yang ada pada python
[program 2]
#Program untuk menemukan jumlah elemen
#dalam array yang diberikan
arr = []
arr = [15, 4, 9, 12]
ans = sum(arr)
print('Sum of the array is ', ans)
output :
hasil jumlah array yaitu 40
itulah beberapa contoh metode
yang dapat digunakan pada program python basic untuk array, tunggu update
artikel tentang belajar python selanjutnya ya, semoga bermanfaat
Diberikan dua angka dan tugasnya
yaitu memilih angka terbesar dengan menggunakan fungsi maximum
Contoh pertama menggunakan fungsi
python if else untuk menemukan hasilnya
[program 1]
# program python untuk menemukan
# nilai maksimum dari dua angka
def maximum(a, b):
if a >= b:
return a
else:
return b
a = 3
b = 5
print(maximum(a, b))
output dari program diatas
yaitu 5
cara membacanya yaitu jika
variabel “a” lebih besar dari variable “b” maka outputnya variabel “a” tetapi
jika salah maka outputnya variabel “b”
dan pada program python
diatas variabel “a” diberikan nilai 3 dan variabel “b” diberikan nilai 5 maka
nilai yang dibaca yaitu variabel “b”
contoh program menggunakan
fungsi max untuk menemukan hasilnya
[program 2]
# program python untuk menemukan
# nilai maksimum dari dua angka
a = 3
b = 5
maximum = max(a, b)
print(maximum)
output nya 5
jika menggunakan fungsi max
program python akan menjadi lebih sederhana, namun cara kerjanya juga sama
dengan program 1 tadi, hanya saja penulisannya lebih simpel karena menggunakan
fungsi yang telah disediakan python
contoh ketiga yaitu
menggunakan ternary operator
prinsipnya sama seperti
program 1 namun pada program 3 ini rumus untuk mencari hasilnya hanya ditulis
dalam 1 baris saja didalam () dengan tetap menggunakan fungsi python if
[program 3]
# program python untuk menemukan
# nilai maksimum dari dua angka
a = 3
b = 5
# penggunaan operator ternary
print(a if a >= b else b)
outputnya 5
itulah beberapa contoh
program python basic untuk mencari nilai maksimum dari dua angka, mulai dari
menggunakan fungsi python if, fungsi max dan menggunakan operator ternary,
tunggu update artikel tentang belajar python selanjutnya ya, semoga bermanfaat
Penjumlahan dua angka pada
python, misalnya diberikan dua angka dan tugasnya yaitu menuliskan program
python untuk mencari hasil dari penjumlahan tersebut
Contoh hasil outputnya :
Input: num1 = 3, num2 = 2
Output = 5
Dalam program di bawah ini
untuk menambahkan dua angka, pertama-tama kalian diminta untuk memasukkan
dua angka dan input dipindai menggunakan fungsi input() dan disimpan dalam
variabel angka1 dan angka2. Kemudian variabel bilangan1 dan bilangan2 dijumlahkan
menggunakan operator aritmatika + dan hasilnya disimpan dalam variabel
penjumlahan. Di bawah ini adalah program Python untuk menambahkan dua angka:
[program 1]
# Python3 program to add two numbers
num1 = 11
num2 = 10
# Adding two nos
sum = num1 + num2
# printing values
print("Sum of {0} and {1} is {2}" .format(num1, num2, sum))
Output nya yaitu
jumlahnya 11 dan 10 yaitu 21
Contoh penjumlahan bilangan
desimal yaitu :
[program 2]
# Python3 program to add two numbers
number1 = input("angka pertama: ")
number2 = input("\nangka kedua: ")
# Adding two numbers
# User might also enter float numbers
sum = float(number1) + float(number2)
# Display the sum
# will print value in float
print("The sum of {0} and {1} is {2}" .format(number1, number2, sum))
angka desimal bisa kalian
tambahkan sendiri pada saat program di runing
Output dari contoh program
python diatas yaitu :
angka pertama : 10.5 angka
kedua : 11.5
jumlah dari 10.5 dan 11.4
yaitu 21.9
itulah contoh program python
basic tentang penjumlahan yang cocok untuk kalian yang sedang ingin belajar
mendalami python, tunggu update contoh program python menarik selanjutnya ya,
semoga bermanfaat
Google Chrome is one of the
most widely used browsers by humans today. However, Google Chrome is not in the
official Ubuntu repositories because Google Chrome is not an open source
software
Download Google Chrome
There are two ways. The
first is downloaded from the official website, and the second is downloaded via
the terminal.
To download google chrome
from their official site, you can directly visit the following url
Google chrome has some
dependency requirements. If these requirements have not been installed, then
the Google Chrome installation process will experience interference and Google
Chrome will not be able to be opened.
The fix is to do the
command
sudo apt-get -f install
If the above process has
been successful, you can run Google Chrome through the application menu