Visual Basic

Download Kumpulan Simulasi Arduino dengan Proteus 8

Projek simulasi proteus ini saya buat sendiri dan akan saya bagikan untuk kalian jadikan referensi belajar, silahkan download kumpulan file dan code nya supaya kalian bisa menjalankan simulasi arduino pada proteus 8 kemudian pelajari sistem kerjanya.

Proteus 8 merupakan software simulasi yang sangat familiar dan banyak sekali fitur nya, selain untuk simulasi juga bisa digunakan untuk mendesain PCB layout.

Komponen arduino dan sensor pada proteus tidak tersedia oleh bawaan aplikasi, melainkan menambahkan library part arduino dan sensornya ke dalam folder library proteus 8

Untuk mendownload software proteus 8 bisa klik link berikut ini

Download Proteus 8.11 Free Full Version

Download Dan Tutorial Berbagai Macam Library Sensor Proteus 8

Simulasi arduino Runiing LED 1

Download file Projek Proteus 8

int pin [] = {13, 12, 11, 10, 9, 8, 7, 6};

unsigned long timeLast;
int interval = 1000;
int i;

void setup() {
  // put your setup code here, to run once:
  for (int i = 0; i < 8; i++) {
    pinMode (pin[i], OUTPUT);
    digitalWrite(pin[i], 0);
  }

  timeLast = millis();
}

void loop() {
  // put your main code here, to run repeatedly:

  if (millis() - timeLast >= interval) {
    timeLast = millis();
    
    for (int j = 0; j < 3; j++){
    run_led(i);
    }
    i++;
    if (i > 2) i = 0;
  }
}

void run_led(int a) {
  switch (a) {
    case 0:
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 0);
      }
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 1);
        delay(100);
      }
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 0);
      }
      for (int i = 7; i >= 0; i--) {
        digitalWrite(pin[i], 1);
        delay(100);
      }
      break;

    case 1:
      for (int i = 3; i >= 0; i--) {
        int offLED = i + 1;
        if (i == 3) {
          offLED = 0;
        }

        int onLED1 = 3 - i;
        int onLED2 = 4 + i;

        int offLED1 = 3 - offLED;
        int offLED2 = 4 + offLED;

        digitalWrite(pin[onLED1], HIGH);
        digitalWrite(pin[onLED2], HIGH);
        digitalWrite(pin[offLED1], LOW);
        digitalWrite(pin[offLED2], LOW);
        delay(100);
      }
      break;

    case 2:
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 0);
      }
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 1);
        digitalWrite(pin[i - 1], 0);
        delay(100);
      }
      for (int i = 0; i <= 7; i++) {
        digitalWrite(pin[i], 0);
      }
      for (int i = 7; i >= 0; i--) {
        digitalWrite(pin[i], 1);
        digitalWrite(pin[i + 1], 0);
        delay(100);
      }
      break;

    case 3:
      for (int i = 3; i >= 0; i--) {
        int offLED = i - 1;
        if (i == 0) {
          offLED = 3;
        }

        int onLED1 = 3 - i;
        int onLED2 = 4 + i;

        int offLED1 = 3 - offLED;
        int offLED2 = 4 + offLED;

        digitalWrite(pin[onLED1], HIGH);
        digitalWrite(pin[onLED2], HIGH);
        digitalWrite(pin[offLED1], LOW);
        digitalWrite(pin[offLED2], LOW);
        delay(100);
      }
      break;
      case 4:
      for (int i = 0; i <= 7; i++) {
        int offLED = i - 1;  //Calculate which LED was turned on last time through
        if (i == 0) {        //for i = 1 to 7 this is i minus 1 (i.e. if i = 2 we will
          offLED = 7;        //turn on LED 2 and off LED 1)
        }                    //however if i = 0 we don't want to turn of led -1 (doesn't exist)
        //instead we turn off LED 7, (looping around)
        digitalWrite(pin[i], HIGH);     //turn on LED #i
        digitalWrite(pin[offLED], LOW); //turn off the LED we turned on last time
        delay(100);
      }
      break;
  }
}

Simulasi Arduino Running LED 2

Download File Projek Proteus 8

byte count = 5, c = 1, maxi = 13, mini = 6;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  for (byte i = 13; i >= 6; i--) {
    pinMode(i, OUTPUT);
    nyalaLed(i, 1);
  }
  pinMode (3, INPUT_PULLUP);
}
void nyalaLed(byte i, byte a) {
  digitalWrite(i, a);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(3) == 0) {
    while (digitalRead(3) == 0) {}
    count++;
    if (count > maxi) {
      maxi--;
      count = 6;
      if (maxi < 6) {
        maxi = 13;
        nyalaLed(6, 1);
        for (byte i = 13; i >= 6; i--) {
          nyalaLed(i, 1);
        }
      }
    }
    Serial.println(count);
    nyalaLed(count - 1, 1);
    nyalaLed(count, 0);
  }
}

Simulasi Arduino LCD 16×2

Download File Projek Proteu 8

Download File Projek Proteus 8

Tanpa I2C dan dengan I2C

#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
  // initialize the LCD
  lcd.begin();
  lcd.setCursor(0,0);
  lcd.print("Visit Us ->");
  lcd.setCursor(0,1);
  lcd.print("anakkendali.com");
}

void loop()
{
}

Simuladi Arduino Membaca ADC dan LCD 16×2

Download File Projek Proteus 8

#define pinAdc0 A0
int adcVal;

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
  // initialize the LCD
  lcd.begin();
}

void loop()
{
  lcd.clear();
  float volt;

  adcVal = analogRead(pinAdc0);
  volt = (adcVal * 5.0) / 1023;
  
  
  lcd.setCursor(0, 0);
  lcd.print("Nilai ADC :");
  lcd.print(adcVal);
  lcd.setCursor(0, 1);
  lcd.print("Tegangan :");
  lcd.print(volt);
  lcd.print(" V");
  delay(500);
}

Simulasi Arduino Sensor Suhu LM35

Download File Projek Proteus 8

#define pinAdc0 39
int adcVal;

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
  // initialize the LCD
  lcd.begin();
  Serial.begin(9600);
}

void loop()
{
  analogReadResolution(12);
  lcd.clear();
  float volt, suhucel;

  adcVal = analogRead(pinAdc0);
  volt = (adcVal * 5.0) / 4095;
  suhucel = 99.1526 * volt + 4.2525 ;

  lcd.setCursor(0, 0);
  lcd.print("Tegangan :");
  lcd.print(volt);
  lcd.print(" V");
  lcd.setCursor(0, 1);
  lcd.print("Suhu :");
  lcd.print(suhucel);
  lcd.print("C");

  Serial.print("Tegangan :");
  Serial.print(volt);
  Serial.print("\tSuhu :");
  Serial.print(suhucel);
  Serial.println(" ^C");
  delay(500);
}

Simulasi Arduino Dot Matrix Max7219

Download File Projek

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// set to 1 if we are implementing the user interface pot, switch, etc
#define USE_UI_CONTROL 0

#if USE_UI_CONTROL
#include <MD_UISwitch.h>
#endif

// Turn on debug statements to the serial output
#define DEBUG 0

#if DEBUG
#define PRINT(s, x) { Serial.print(F(s)); Serial.print(x); }
#define PRINTS(x) Serial.print(F(x))
#define PRINTX(x) Serial.println(x, HEX)
#else
#define PRINT(s, x)
#define PRINTS(x)
#define PRINTX(x)
#endif

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

// HARDWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
//MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// Scrolling parameters
#if USE_UI_CONTROL
const uint8_t SPEED_IN = A5;
const uint8_t DIRECTION_SET = 8;  // change the effect
const uint8_t INVERT_SET = 9;     // change the invert

const uint8_t SPEED_DEADBAND = 5;
#endif // USE_UI_CONTROL

uint8_t scrollSpeed = 25;    // default frame delay value
textEffect_t scrollEffect = PA_SCROLL_LEFT;
textPosition_t scrollAlign = PA_LEFT;
uint16_t scrollPause = 2000; // in milliseconds

// Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE 75
char curMessage[BUF_SIZE] = { "" };
char newMessage[BUF_SIZE] = { "Hello! Enter new message?" };
bool newMessageAvailable = true;

#if USE_UI_CONTROL

MD_UISwitch_Digital uiDirection(DIRECTION_SET);
MD_UISwitch_Digital uiInvert(INVERT_SET);

void doUI(void)
{
  // set the speed if it has changed
  {
    int16_t speed = map(analogRead(SPEED_IN), 0, 1023, 10, 150);

    if ((speed >= ((int16_t)P.getSpeed() + SPEED_DEADBAND)) ||
      (speed <= ((int16_t)P.getSpeed() - SPEED_DEADBAND)))
    {
      P.setSpeed(speed);
      scrollSpeed = speed;
      PRINT("\nChanged speed to ", P.getSpeed());
    }
  }

  if (uiDirection.read() == MD_UISwitch::KEY_PRESS) // SCROLL DIRECTION
  {
    PRINTS("\nChanging scroll direction");
    scrollEffect = (scrollEffect == PA_SCROLL_LEFT ? PA_SCROLL_RIGHT : PA_SCROLL_LEFT);
    P.setTextEffect(scrollEffect, scrollEffect);
    P.displayClear();
    P.displayReset();
  }

  if (uiInvert.read() == MD_UISwitch::KEY_PRESS)  // INVERT MODE
  {
    PRINTS("\nChanging invert mode");
    P.setInvert(!P.getInvert());
  }
}
#endif // USE_UI_CONTROL

void readSerial(void)
{
  static char *cp = newMessage;

  while (Serial.available())
  {
    *cp = (char)Serial.read();
    if ((*cp == '\n') || (cp - newMessage >= BUF_SIZE-2)) // end of message character or full buffer
    {
      *cp = '\0'; // end the string
      // restart the index for next filling spree and flag we have a message waiting
      cp = newMessage;
      newMessageAvailable = true;
    }
    else  // move char pointer to next position
      cp++;
  }
}

void setup()
{
  Serial.begin(57600);
  Serial.print("\n[Parola Scrolling Display]\nType a message for the scrolling display\nEnd message line with a newline");

#if USE_UI_CONTROL
  uiDirection.begin();
  uiInvert.begin();
  pinMode(SPEED_IN, INPUT);

  doUI();
#endif // USE_UI_CONTROL

  P.begin();
  P.displayText(curMessage, scrollAlign, scrollSpeed, scrollPause, scrollEffect, scrollEffect);
}

void loop()
{
#if USE_UI_CONTROL
  doUI();
#endif // USE_UI_CONTROL

  if (P.displayAnimate())
  {
    if (newMessageAvailable)
    {
      strcpy(curMessage, newMessage);
      newMessageAvailable = false;
    }
    P.displayReset();
  }
  readSerial();
}

Simulasi Arduino Motor DC Driver L298N / L293D

Download File Projek

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

#define pwm2 9
#define dir2 8
#define pwm1 11
#define dir1 10
#define pinb1 2
#define pinb2 3

void motor_run(int a, int b) {
  if (a < 0) {
    digitalWrite(dir1, 1);
    analogWrite(pwm1, a + 255);
  } else if (a >= 0) {
    digitalWrite(dir1, 0);
    analogWrite(pwm1, a);
  }

  if (b < 0) {
    digitalWrite(dir2, 1);
    analogWrite(pwm2, b + 255);
  } else if (b >= 0) {
    digitalWrite(dir2, 0);
    analogWrite(pwm2, b);
  }
}

void setup() {
  // put your setup code here, to run once:
  lcd.begin();
  pinMode(dir1, OUTPUT);
  pinMode(dir2, OUTPUT);
  pinMode(pinb1, INPUT_PULLUP);
  pinMode(pinb2, INPUT_PULLUP);
  motor_run(0, 0);
}

void loop() {
  // put your main code here, to run repeatedly:

  if (digitalRead(pinb1) == 0) {
    lcd.clear();
    while (1) {
      int kec = map(analogRead(A0), 0, 1023, 0, 255);
      lcd.setCursor(0, 0);
      lcd.print("Arah Maju");
      lcd.setCursor(0, 1);
      lcd.print("PWM :");
      lcd.print(kec);

      motor_run(-kec, kec);
      if (digitalRead(pinb2) == 0) {
        break;
      }
    }
  } else if (digitalRead(pinb2) == 0) {
    lcd.clear();
    while (1) {
      int kec = map(analogRead(A0), 0, 1023, 0, 255);
      lcd.setCursor(0, 0);
      lcd.print("Arah Mundur");
      lcd.setCursor(0, 1);
      lcd.print("PWM :");
      lcd.print(kec);
      motor_run(kec, -kec);
      if (digitalRead(pinb1) == 0) {
        break;
      }
    }
  }

}

Itulah temen-temen projek simulasi arduino yang sudah saya buat, dan jika ada pertanyaan mengenai projek diatas, silahkan berkomentar dibawah ini.

Keyword

  1. Projek Simulasi Proteus 8
  2. Kumpulan Simulasi Proteus 8
  3. Simulasi Arduino Proteus 8
  4. Proteus Arduino
  5. Arduino Simulasi
  6. Tutorial Simulasi Arduino
  7. Belajar Simulasi Arduino
  8. Belajar Arduino dengan Simulasi
chaerul

View Comments

Recent Posts

Panduan Lengkap: Cara Menyiapkan Klaster Kubernetes pada Ubuntu 22.04 LTS

Pendahuluan Dalam dunia pengembangan perangkat lunak yang terus berkembang, Kubernetes telah muncul sebagai alat kunci dalam orkestrasi…

1 week ago

AplikasiAkademik.com: Solusi Terbaik untuk Manajemen Sekolah yang Efisien

Mengelola sebuah sekolah atau lembaga pendidikan adalah tugas yang kompleks dan penuh tantangan. Dengan berbagai…

7 months ago

Cara Mudah Menginstal OpenVPN Server di Ubuntu 20.04 di Huaweicloud Panduan Langkah demi Langkah

Selamat datang di artikel kami tentang cara menginstal OpenVPN server di Ubuntu 20.04 di HuaweiCloud!…

12 months ago

Install Docker Portainer dan Nginx Proxy Manager Ubuntu Server

Dalam dunia pengembangan aplikasi, salah satu hal yang menjadi penting adalah mengelola dan memonitor kontainer…

1 year ago

Tutorial led blinking lengkap, Wiring & Code

Tutorial led blinking. LED (Light Emitting Diode) merupakan salah satu komponen elektronik yang paling umum…

1 year ago

Tutorial LCD Display Lengkap dengan wiring & code untuk pemula

Tutorial LCD Display, ini merupakan salah satu komponen yang sering digunakan dalam project elektronika sebagai…

1 year ago