Day 15
LAB:
//Simple Motor Speed Control Program with potentiometer
const int MOTOR=9; //Motor on Digital Pin 9
const int POT=1; //Pot on A1
int val = 0;
void setup()
{
pinMode (MOTOR, OUTPUT);
Serial.begin(9600);
}
void loop()
{
val = analogRead(POT);
Serial.println(val);
val = map(val, 0, 1026, 0, 256);
val = constrain(val, 0, 256);
analogWrite(MOTOR, val);
delay(10);
}
Homework:
int il, i2;
int *pl, *pls;
...
il = 5;
p1 = &il;
i2 = *p1/2 + 10;
p2 = pl;
What is the value of i1? - 5
What is the value of i2? - 12.5
What is the value of *p1? - 5
What is the value of *p2? - 5

Comments
Post a Comment