Go Down

Topic: Different delays in a loop (Read 2303 times) previous topic - next topic

Hento

Okay I've collected some data. the first row's I didn't do anything, then I tried covering one of the diodes slightly, then I put my finger on it covering it completely, finally I tried covering the other diode.

code:
Code: [Select]
x=0
lightLevel1=1530
lightLevel2=1530
x=-255
lightLevel1=1530
lightLevel2=1785
x=-1530
lightLevel1=0
lightLevel2=1530
x=255
lightLevel1=1785
lightLevel2=1530


The diodes where placed fairly close to each other, so when I tried covering one, I accidently might have covered the other slightly. But I can't see why this would affect the outcome. :)

PaulS

Are the values for lightLeveln before or after mapping?


PaulS

Is your from range in the map call still 0,1?

What values do lightLevel1 and lightLevel2 have before mapping?

Hento

Yes it's still 0,1. Sorry I forgot to print them before mapping, I'll get right to that as well as changing the range in the morning. :)

Hento

#20
Mar 04, 2010, 10:44 am Last Edit: Mar 04, 2010, 10:47 am by Hento Reason: 1
Okay, I've changed the bit setting and collected some data from before and after mapping. "omapp" stands for before mapping :)

Code: [Select]
lightLevel1omapp=5
lightLevel2omapp=3
x=1
lightLevel1=1
lightLevel2=0

lightLevel1omapp=4
lightLevel2omapp=0
x=0
lightLevel1=0
lightLevel2=0

lightLevel1omapp=0
lightLevel2omapp=89
x=-22
lightLevel1=0
lightLevel2=22


It's clear that the boundaries of x have to be changed now that there's another bit setting.

Hento

Never mind. Problem solved ;D, figured out that using to separate loops for controlling the two motors wasn't such a great idea. When the "else- condition" was fulfilled in one, the delay caused the other motor to keep on rotating :P.

Sorry if I've wasted your time and thank you for the help :)

PaulS

You know, the very next thing I was going to ask you to do was post ALL of your code. Glad you got it figured out.

Go Up