School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,148 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,727 people online right now. Registration is fast and FREE... Join Now!




Code to Flowchart

 

Code to Flowchart, involves if and while statements

sl02ggp

18 Oct, 2009 - 12:42 PM
Post #1

New D.I.C Head
*

Joined: 9 Sep, 2009
Posts: 39

I know most of the if statements are diamonds shapes and count is a process, i am correct? And the while statement goes back, after the count?

Here is my code, need some help translating it to a flowchart.


#define LightThreshold 20
#define Fast 60
#define Slow 40

task main()
{
SetSensorType(S1, SENSOR_TYPE_LIGHT);
SetSensorMode(S1, SENSOR_MODE_PERCENT);

SetSensorType(S2, SENSOR_TYPE_LIGHT);
SetSensorMode(S2, SENSOR_MODE_PERCENT);

int count=0;

while(count < 2)
{
if (SENSOR_1>LightThreshold&&SENSOR_2>LightThreshold)
{
OnFwd(OUT_AC, Slow);
}
if (SENSOR_1>=LightThreshold&&SENSOR_2<LightThreshold)
{
Off(OUT_C);
OnFwd(OUT_A, Fast);
}
if (SENSOR_1<LightThreshold&&SENSOR_2>=LightThreshold)
{
Off(OUT_A);
OnFwd(OUT_C, Fast);
}
if (SENSOR_1<LightThreshold&&SENSOR_2<LightThreshold)
{
if (count == 0)
{
TextOut (0, LCD_LINE3, "Good Job!, Bot reaches point B" );
OnFwd (OUT_C, Fast);
OnRev (OUT_A, Fast);
Wait (500);
}
count=count+1;
}
}
Off(OUT_AC);
PlayFile("CASHREG.rso");
Wait(2000);
}


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 04:04PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month