Pages: 1 [2]   Go Down
Author Topic: Different delays in a loop  (Read 1639 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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. smiley
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the values for lightLeveln before or after mapping?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

after
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

What values do lightLevel1 and lightLevel2 have before mapping?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I've changed the bit setting and collected some data from before and after mapping. "omapp" stands for before mapping smiley

Code:
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.
« Last Edit: March 04, 2010, 04:47:25 am by Hento » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-razz.

 Sorry if I've wasted your time and thank you for the help smiley
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2]   Go Up
Jump to: