Go Down

Topic: need some help to writing a code (Read 1 time) previous topic - next topic

wildbill

I'm really not clear from your description what you're trying to do, but looking at the code, it seems that voltage1 controls the forward and back (directions?) and voltage2 does left and right. This line though:
Code: [Select]
    else if (voltage2 >= 2.5)  {
Means that you only consider left and right if the forward and back conditions aren't met. Is that what you wanted?

dany151

YES...
i did some conditions like 
Code: [Select]
   if (voltage1 >= 2.5 && voltage2 <=2)  { ...but it is not working good ...so im trying to write the code in another way

UKHeliBob

You start a series if if/else statements checking voltage1 the, in the same if/else start testing voltage2 so if any of the voltage1 conditions are true the test of voltage2 will not happen.  Split the voltage checks into 2 blocks of if/else.  Test voltage1 and take action then in a separate if/else test voltage2 and take action.

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

dany151

good idea UKHeliBob ... i will try to split them and check ... i hope this solve my problem ...i appreciate your help..thnx

Go Up