Is there anyone here who can help me comment this code? please, it's urgent.
pitMiguel.docx11.doc (70.5 KB)
Is there anyone here who can help me comment this code? please, it's urgent.
pitMiguel.docx11.doc (70.5 KB)
please, it's urgent
When is our assignment due to be handed in ?
Why did you not post your code here ?
What problem are you having ?
UKHeliBob:
When is our assignment due to be handed in ?Why did you not post your code here ?
What problem are you having ?
my teacher asked me to comment. the code is attached along with circuit diagram.
I can deliver by tomorrow
Good luck.
miguiboyy:
my teacher asked me to comment. the code is attached along with circuit diagram.
I can deliver by tomorrow
good night
OP's code (extracted from his 70kB Word document)
int D0 = 2;
int D1 = 3;
int D2 = 4;
int D3 = 5;
int 7segAtive = 6;
void setup() {
pinMode(D0,OUTPUT);
pinMode(D1,OUTPUT);
pinMode(D2,OUTPUT);
pinMode(D3,OUTPUT);
pinMode(7segAtive,OUTPUT);
Serial.begin(9600);
}
void write7seg(int x) {
digitalWrite(D0,bitRead(x,0));
digitalWrite(D1,bitRead(x,1));
digitalWrite(D2,bitRead(x,2));
digitalWrite(D3,bitRead(x,3));
}
int hundred,dozen,units;
void loop() {
float temp = (float) analogRead(A0)/ 2.0485 -49.76 ;
int tempI= temp *10;
Serial.println(tempI);
digitalWrite(7segAtive,0);
hundred= tempI/100 ;
write7seg(hundred);
delay(1000);
Serial.println(hundred);
dozen= ( tempI/10 )%10; ;
write7seg(dozen);
delay(1000);
Serial.println(dozen);
units= tempI%10;
write7seg(units);
delay(1000);
Serial.println(units);
}
It appears to be a single 4 bit display ( BCD - binary coded decimal ) which displays a temperature. Each digit of the three digit temperature is displayed separately with a 1 second interval between each digit. The cycle is repeated
Comments:
Break your 70k file down, and look for obvious functional blocks.
Then it should be relatively easy to review and add your comments to each block when you understand what it’s doing.
If you make a serious effort, and post the commented code blocks back here (properly!), there’s a good chance we can help you over the next few days.
my teacher asked me to comment. the code
Then why are you asking for someone else to do it for you ?
Comment the code as best you can then post it here (not in a Word document) and you may get some help