Skip to main content

Posts

Showing posts from August, 2017

Day 2: Math Operations, Overflow and Underflow, Printf and Scanf

Lab Today we started with our first Arduino lab. We first wanted to make one LED on a breadboard blink, then get 4 LEDs to blink. I was able to do this successfully using the code below. void setup() {   // put your setup code here, to run once: pinMode(11, OUTPUT); pinMode(10, OUTPUT); pinMode(9, OUTPUT); pinMode(3, OUTPUT); } void loop() {   // put your main code here, to run repeatedly:   digitalWrite(11, HIGH);      delay(500);   digitalWrite(11,LOW);   digitalWrite(10,HIGH);      delay(500);   digitalWrite(10,LOW);   digitalWrite(9,HIGH);      delay(500);   digitalWrite(9,LOW);      delay(100);   digitalWrite(11, HIGH);   digitalWrite(3,HIGH);   digitalWrite(10,HIGH);   digitalWrite(9,HIGH);   delay(100);   digitalWrite(11, LOW);   digitalWrite(3,LOW);   digitalWrite(10,LOW);   digitalWrite(9,LOW); ...

Day 1: Introduction to Programming

Summary We first learned about the different types of applications of programming to various engineering fields. Then we went over the types of computer languages, which included, machine, assembly, and high-level languages. C and C++, the languages used in this course, are both high-level languages. We were introduced to the engineering problem solving methodology, which is as follows: Problem statement Input/output description Hand example Algorithm development Test solution We then did an activity which utilized this. We got together in groups to perform steps 1-3 in trying to find the distance between two points, then tested this on the computer.  After that, we learned about constants and variables, and about different numeric data types.  Problems 1 //First day //Distance formula program //This program calculates distance between two points #include <stdio.h> #include <math.h> int main(void){ //Declared variables double x1=...