day_14

I'm not too sure on what the homework consists of. Since finding the values of each variable was the only thing that was asked us to do.I'm pretty sure that this is all that was wanted from us.

#include<stdio.h>
int main(void)
{
int i1,i2;
int*p1, *p2;
i1=5;
p1=&i1;
i2=*p1/2+10;
p2=p1;

printf("i1 value:%d adress:%u\n",i1,&i1);
printf("i2 value:%d adress:%u\n",i2,&i2);
printf("p1 value:%d\n",p1);
printf("p2 value:%d\n",p2);

return 0;


}







































Lab: I had trouble getting the motor to work initially. It would vibrate when I plugged the battery in. After spending about an hour testing the comp i figured out that my battery was at 6.3V. Using a new battery worked.
//Simple Motor Speed Control Program
const int MOTOR=9;//Motor on Digital Pin 9
int pot=A0;
int val=0;
void setup()
{
 pinMode (MOTOR, OUTPUT);
 Serial.begin(9600);
}
void loop()
{
val=analogRead(pot);
 analogWrite(MOTOR, val);
 Serial.println(val);
}


Comments

Popular posts from this blog

Day_13

Day 18 WH