Posts

Showing posts from September, 2018

Lab 3/ HW 3 (9/6)

Image
//Program to turn on/off two LEDs with buttons const int LED1=9;                                    //The LED is connected to pin 9 const int LED2=7; const int BUTTON1=2;                                 //The Button is connected to pin 2 const int BUTTON2=4; boolean lastButton = LOW;                           //Variable containing the previous button state boolean currentButton = LOW;                        //Variable containing the current button state boolean ledOn = false;                              //The present state of the LED (on/off) void setup() {  pinMode (LED1, OUTPUT);    ...

Lab 2/ HW 2 (9/4)

Image
void setup() {   pinMode(10,OUTPUT);  //Initialize Pin   pinMode(9,OUTPUT);   pinMode(7,OUTPUT);   pinMode(6,OUTPUT); } void loop() {   digitalWrite(10,HIGH);   //Set the LED On   delay(50);                        //Wait for 50 ms   digitalWrite(10,LOW);   //Set the LED Off   delay(50);                       //Wait for 50 ms   digitalWrite(9,HIGH);   delay(50);   digitalWrite(9,LOW);   delay(50);   digitalWrite(7,HIGH);   delay(50);   digitalWrite(7,LOW);   delay(50);   digitalWrite(6,HIGH);   delay(50);   digitalWrite(6,LOW);   delay(50);   digitalWrite(7,HIGH);   delay(50);   digitalWrite(7,LOW);   delay(50);   digitalWrite(9,HIGH);   delay(50);   digitalWrite(9,LOW);   ...

Homework 1 (8/30)

Image
/* Program to convert 1 meter to miles */ #include < stdio.h > #include < math.h > int main ( void ) { /* Declare and initialize variables. */ double meter1 = 5 , mile1 = 1609.344 , output1 ; /* Conversion of units. */ output1 = meter1 / mile1 ; /* Print conversion. */ printf ( "approximately ""%8.9f miles " , output1 ); /* Exit program. */ return 0 ; } Meters to miles input & output ------------------------------------------------------------------ /* Program to convert 1 meter to miles */ #include < stdio.h > #include < math.h > int main ( void ) { /* Declare and initialize variables. */ double TempR , TempC = 25 ; /* Conversion of units. */ TempR = ( TempC + 273.15 )* 1.8 ; /* Print conversion. */ printf ( "The entered Celcius is about""%8.3f degrees " , TempR ); /* Exit program. */ return 0 ; } Celsius to Rankine input & output ...