0% found this document useful (0 votes)
23 views

Komputer Pemrograman Dasar: Perkembangan

This document provides an introduction and overview of using Arduino for programming simple games to practice focus and concentration. It discusses what Arduino is, why it is useful, types of Arduino boards, how to program Arduino, basic programming structures like variables, data types, arithmetic, conditions, loops, functions, and arrays. Examples of code are provided to demonstrate digital and analog input/output, serial communication, and basic programming concepts.

Uploaded by

Elect Yan Lumoso
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Komputer Pemrograman Dasar: Perkembangan

This document provides an introduction and overview of using Arduino for programming simple games to practice focus and concentration. It discusses what Arduino is, why it is useful, types of Arduino boards, how to program Arduino, basic programming structures like variables, data types, arithmetic, conditions, loops, functions, and arrays. Examples of code are provided to demonstrate digital and analog input/output, serial communication, and basic programming concepts.

Uploaded by

Elect Yan Lumoso
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Pemrograman

Perkembangan Dasar Arduino


“Buat Game Arduino Sederhana Untuk Latih Fokus dan Konsentrasi”
Komputer
Ajang Rahmat - KelasRobot.com
EVALUASI

22
EVALUASI

33
Resume - Ajang Rahmat

1. SMKN 1 Sumedang - Teknik 1. PT. Daya Anugerah Mandiri


Komputer Jaringan 2. PT. Indokemas Sukses Makmur
2. Universitas Siber Asia - Teknik 3. PT. Graha 1001 Jaya
Informatika (Semester 1) 4. Robotic Explorer
5. Kelas Robot

44
Apa Itu Arduino?

Source: https://www.arduino.cc/en/Guide/Introduction

Arduino is an open-source electronics platform based on easy-to-use hardware and


software. Arduino boards are able to read inputs - light on a sensor, a finger on a
button, or a Twitter message - and turn it into an output - activating a motor, turning
on an LED, publishing something online.

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?

Siapkan Software Yang Dibutuhkan:

1. Arduino IDE (Code Editor, Compiler) - https://www.arduino.cc/en/software


2. USB Driver CH340 - Khusus Yang Non Compatible Arduino USB Driver
https://kelasrobot.com/cara-install-usb-driver-ch340g-ch340-untuk-arduino/

Siapkan Hardware Yang Dibutuhkan

1. Laptop / PC (OS Windows, Linux, Mac)


2. Arduino dan DKK

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;

String namaVariabel = "Hello World";

1616
//Numerik
byte namaVariabel1 = 13;
int namaVariabel2 = 300;

Tipe Data float namaVariabel3 = 0.56;


long namaVariabel4 = 19010121;

//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() {

Aritmatika hasil = nilai1 + nilai2;


hasil = nilai1 - nilai2;
hasil = nilai1 / nilai2;
hasil = nilai1 * nilai2;
hasil++;
hasil--;
}

void loop() {}

1818
if (kondisi) {
Kondisi
//perintah
}
else if (kondisi) {
//perintah
}
else {
//perintah
}

1919
while(kondisi){
Perulangan
//perintah
//sebaiknya ditambahkan increament
}

for(nilaiAwal, kondisi, increament/discreament){


//perintah
}

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

You might also like