top of page

MD FARHAD HOSSAIN
22151447

HOMEWORK PAGE

All My Stories

Arduino

Check back soon
Once posts are published, you’ll see them here.
Screenshot (3)_edited.jpg

int ledPin = 13;

int ledPin2 = 5;

void setup()

{

  pinMode(ledPin,OUTPUT);

  pinMode(ledPin2,OUTPUT);

}

 

 

 

 

void loop()

{

  digitalWrite(ledPin,HIGH);

  digitalWrite(ledPin2,LOW);

  delay(1000);

  digitalWrite(ledPin,LOW);

  digitalWrite(ledPin2,HIGH);

  delay(1000);

}

int LED1=12;

int LED2=13;

void setup()

{

  pinMode(LED1, OUTPUT);

  pinMode(LED2, OUTPUT);   

}

void loop()

{

    digitalWrite(LED1,HIGH);

    digitalWrite(LED2,LOW);

    delay(1000);

    digitalWrite(LED2,HIGH);

    digitalWrite(LED1,LOW);

    delay(1000);

}

Screenshot (6)_edited.jpg

int count = 0;

 

long duration;

// PULSE WIDTH

 

void setup() {

    // set Serial communication

    Serial.begin(115200);

    // set pin mode

    pinMode(TrigPin, OUTPUT);

    pinMode(EchoPin, INPUT);

    // init pin

    digitalWrite(TrigPin, LOW);

    delay(1);

}

 

void loop() {

    Serial.println(count++);

    Serial.println(getDistance());

    Serial.println("");

    Serial.println("");

    delay(1000);

}

 

long getDistance() {

    // trig

    digitalWrite(TrigPin, LOW);

    delayMicroseconds(2);

    digitalWrite(TrigPin, HIGH);

    delayMicroseconds(10);

    digitalWrite(TrigPin, LOW);

    // echo

    duration = pulseIn(EchoPin, HIGH);    

    return duration * 0.34029 / 2;      

}

Screenshot (5)_edited.jpg

// include the library code:

#include <LiquidCrystal.h>

 

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 

void setup() {

  // set up the LCD's number of columns and rows:

  lcd.begin(16, 2);

  // Print a message to the LCD.

  lcd.print("Farhad, 22151447!");

}

 

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);

}

Screenshot (8)_edited.jpg
Wave

 int pin_a = 7;

int pin_b = 6;

int pin_c = 5;

int pin_d = 10;

int pin_e = 11;

int pin_f = 8;

int pin_g = 9;

int pin_p = 4;

int numTable[10][8] = {

//a  b  c  d  e  f  g  dp

{1, 1, 1, 1, 1, 1, 0, 0},     //0

{0, 1, 1, 0, 0, 0, 0, 0},     //1

{1, 1, 0, 1, 1, 0, 1, 0},     //2

{1, 1, 1, 1, 0, 0, 1, 0},     //3

{0, 1, 1, 0, 0, 1, 1, 0},     //4

{1, 0, 1, 1, 0, 1, 1, 0},     //5

{1, 0, 1, 1, 1, 1, 1, 0},     //6

{1, 1, 1, 0, 0, 0, 0, 0},     //7

{1, 1, 1, 1, 1, 1, 1, 0},     //8

{1, 1, 1, 1, 0, 1, 1, 0},     //9

};

void setup()

{

for (int i = 4; i <= 11; i++)

{

pinMode(i, OUTPUT);

}

}

void loop()

{

for (int i = 0; i < 10; i++)

{

digitalWrite(pin_a, numTable[i][0]);

digitalWrite(pin_b, numTable[i][1]);

digitalWrite(pin_c, numTable[i][2]);

digitalWrite(pin_d, numTable[i][3]);

digitalWrite(pin_e, numTable[i][4]);

digitalWrite(pin_f, numTable[i][5]);

digitalWrite(pin_g, numTable[i][6]);

digitalWrite(pin_p, numTable[i][7]);

delay(200);

}}

Screenshot (7)_edited.jpg

Autodesk

Screenshot (47)_edited.png
Screenshot (45)_edited.png
Screenshot (46)_edited.png

Have Faith. Subscribe

Thanks for submitting!

Contact
bottom of page