10 Leds Running - Combine PORTB and PORTD

  


https://www.tinkercad.com

Script



// Lampu LED Berjalan Menggunakan Arduino UNO
// Menyalakan LED dengan Aktif HIGH

int RunBitOld;
int RunBit;
byte RunBitH;
byte RunBitL;
byte RunBitB;
byte RunBitD;


void setup()
{
  Serial.begin (9600);
  DDRD = B11110000;  // sets Arduino pins 4 to 7 as outputs, pin 0 to 3 as input
  DDRD = DDRD | B11110000;  // this is safer as it sets pins 4 to 7 as outputs
                        // without changing the value of pins 0 to 3,
  DDRB = B00111111;  // sets Arduino pins 8 to 13 as outputs
  DDRB = DDRB | B00111111;  // this is safer as it sets pins 8 to 13 as outputs

  PORTD = B11110000; // sets digital pins 4 to 7 HIGH
  PORTB = B00111111; // sets digital pins 8 to 13 HIGH
  RunBit = B11111111;
  RunBitH = B00111111;
  RunBitL = B11110000;
}
 
void loop()
{
//menyala secara bergilir
 
 
  Serial.print ("RunBitH = ");
  Serial.println (RunBitH);

  Serial.print ("RunBitL = ");
  Serial.println (RunBitL);

 
  PORTB = RunBitH & B00111111;
  PORTD = RunBitL & B11110000;
  RunBit = (RunBitH * 256) + RunBitL;
  Serial.print ("RunBit = ");
  Serial.println (RunBit);

 
  RunBit = RunBit >> 1;
  Serial.print ("RunBit Geser = ");
  Serial.println (RunBit);

 
  RunBitH = (RunBit - RunBitL)/256;
  RunBitL = RunBit & B11111111;
 
  if (RunBitL == 0){
    RunBitH = B00111111;
    RunBitL = B11111111;
  }
  delay(1000);

 
}

Lapis Aspal Beton (laston)

Lapis Aspal beton adalah beton aspal yang  bergradasi menerus, lapis aspal beton (laston) juga sering disebutl dengan AC (Asphal Concrete), ...