Komputer Pemrograman Dasar: Perkembangan
Komputer Pemrograman Dasar: Perkembangan
22
EVALUASI
33
Resume - Ajang Rahmat
44
Apa Itu Arduino?
Source: https://www.arduino.cc/en/Guide/Introduction
You can tell your board what to do by sending a set of instructions to the
microcontroller on the board. To do so you use the Arduino programming language
(based on Wiring), and the Arduino Software (IDE), based on Processing.
55
Arduino Untuk Apa?
https://create.arduino.cc/projecthub
66
Mengapa Arduino?
Source: https://www.arduino.cc/en/Guide/Introduction
1. Inexpensive - Arduino boards are relatively inexpensive compared to other microcontroller platforms. The least expensive version of the
Arduino module can be assembled by hand, and even the pre-assembled Arduino modules cost less than \$50
2. Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux operating systems. Most microcontroller
systems are limited to Windows.
3. Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for beginners, yet flexible
enough for advanced users to take advantage of as well. For teachers, it's conveniently based on the Processing programming environment, so
students learning to program in that environment will be familiar with how the Arduino IDE works.
4. Open source and extensible software - The Arduino software is published as open source tools, available for
extension by experienced programmers. The language can be expanded through C++ libraries, and people wanting to understand the
technical details can make the leap from Arduino to the AVR C programming language on which it's based. Similarly, you can add AVR-C code
directly into your Arduino programs if you want to.
5. Open source and extensible hardware - The plans of the Arduino boards are published under a Creative Commons
license, so experienced circuit designers can make their own version of the module, extending it and improving it. Even relatively inexperienced
users can build the breadboard version of the module in order to understand how it works and save money.
6. COMMUNITY
77
Bagaimana Cara Menggunakan Arduino?
88
Jenis Jenis Arduino
https://www.arduino.cc/en/main/products
99
Arduino Uno Image Source: https://store.arduino.cc/usa/arduino-uno-rev3
1010
Pemrograman Arduino
Bare Minimum
void setup() {
// put your setup code here, to run once:
void loop() {
// put your main code here, to run repeatedly:
1212
int nilai = 100;
void setup() {
Komunikasi Serial Serial.begin(9600);
Serial.println("Hello World");
Serial.println(nilai);
}
void loop() {
if (Serial.available()) {
char kode = Serial.read();
Serial.print(kode);
}
}
1313
void setup() {
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
digital / analog write
}
void loop() {
digitalWrite(4, HIGH); // LOW untuk OFF
analogWrite(3, 100); //PWM Set 0-255
delay(1000);
digitalWrite(4, 0);
analogWrite(3, 0);
delay(1000);
}
1414
digital / analog read void setup() {
Serial.begin(9600);
pinMode(2, INPUT);
}
void loop() {
Serial.println(digitalRead(2));
Serial.println(analogRead(A0));
}
1515
Variabel
int namaVariabel;
int nama_variabel = 0;
int nama_variabel = 130;
1616
//Numerik
byte namaVariabel1 = 13;
int namaVariabel2 = 300;
//Text
char nama_variabel1 = 'a';
char* nama_variabel2 = "Hello World";
char nama_variabel3[] = "Hello World";
String nama_variabel4 = "Hello Wolrd";
//Boolean
boolean nama_variabel5 = false;
bool nama_variabel6 = true;
1717
int nilai1 = 10, nilai2 = 2, hasil;
void setup() {
void loop() {}
1818
if (kondisi) {
Kondisi
//perintah
}
else if (kondisi) {
//perintah
}
else {
//perintah
}
1919
while(kondisi){
Perulangan
//perintah
//sebaiknya ditambahkan increament
}
2020
void namaFungsi(parameter){
Fungsi
//perintah
}
int namaFungsi2(parameter){
int hasil;
//perintah
return hasil;
}
2121
int dataArray[4] = {10, 23, 50, 45};
Array
void setup() {
Serial.begin(9600);
Serial.println(dataArray[0]);
}
void loop() {}
2222
Terimakasih...
2323