nice one i see you got your
nice one i see you got your cert … well done … and great job getting the servos to work … you should be capable of doing a lot with your board now… are you going to attempt lab15 ??? … I think ill give it a miss for a while and focus on other things.
anyway have most of lab14 done … as there was 3 mains in the program code i opted to do the third one … might try another one which uses the mailbox when i get done … but have got a couple of issues you might be able to help me with … first off the convert number … in arduino this is simple with the map function … but even from searching the web i couldnt find a suitable solution and eventually created a rather long way of getting it done and it converts the reading and maps the distance from 0cm to 2cm … but dose it correctly so thats good …
so would like to see how you did it as im sure there has to be a better way than the way i did it … posted my way below …
only thing im stuck on is the sysTick_Handler as i cannot figure out what goes in here … thinking its something to interrupt the ADC between taking readings for the distance so if you could give me some help on this id appreciate it.
will do up a post on debug and how i go about it but im pretty sure you will have used most of it every time you programm …
my code for conver number … lol dont laugh its long but works
unsigned long Convert(unsigned long sample){
while (sample <=409){
d=sample%10;
Distance = (sample-d)/2;
return Distance;
}
while (sample >409 && sample <=859){ //859
d=sample/2%10;
Distance = (sample/2)-d;
return Distance;
}
while (sample >859 && sample <=1269){
d=sample%10;
Distance = ((sample-d)/2)-10;
return Distance;
}
while (sample >1269 && sample <=1719){
d=sample%10;
Distance = ((sample-d)/2)-15;
return Distance;
}
while (sample >1719 && sample <=2129){
d=sample%10;
Distance = ((sample-d)/2)-20;
return Distance;
}
while (sample >2129 && sample <=2579){
d=sample%10;
Distance = ((sample-d)/2)-25;
return Distance;
}
while (sample >2579 && sample <=2989){
d=sample%10;
Distance = ((sample-d)/2)-30;
return Distance;
}
while (sample >2989 && sample <=3439){
d=sample%10;
Distance = ((sample-d)/2)-35;
return Distance;
}
while (sample >3439 && sample <=3849){
d=sample%10;
Distance = ((sample-d)/2)-40;
return Distance;
}
while (sample >3849 && sample <=4097){
d=sample%10;
Distance = ((sample-d)/2)-45;
return Distance;
}
//return Distance; // replace this line with real code
}