Pages: [1]   Go Down
Author Topic: Interface arduino with C#  (Read 1661 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I'm using C# to send values to my arduino such as 12 and 24 to my arduino. I've got the coding were my arduino reads 12 if i send <12> from C# and when i send * an infinte for loop is activated. Now I got the infinite for loop to go from 0 to 15 and start again from 0 to 15 and this will keep on going until the arduino is switched on.

my infite for loop  
for (int b = 0; b<17; b++)
  {
   look what is the value of serialValue
  and do something
}

I did this infinite for loop because i'm storing the C# values on the ardunio, which are then stored in an array called serialValues, and when i send * from C# the infinte loop starts.
As explaind i want the arduino to go through all the values it received and if it receives 12 and pin 10 is high then pin 12 is high etc..

the problem i'm facing is that when the infite loop starts again from 0 and the value 12 reappeard from the array and pin 10 is low, pin 12 remains high and i want it to go LOW. And when b starts from 0 again and pin 10 is high i want pin12 u go high again

HERE is my coding I would appreciate any help cause i'm a college student and i need to solve this problme ASAP

#
Logged

Middle of the Pacific
Offline Offline
Full Member
***
Karma: 0
Posts: 129
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First of all your for loop by itself is not infinite, unless placed inside another loop.  Also the way that it is setup now it goes from 0 to 16 not 15.

if you post your code with a better explanation of what you are trying to do we might be able to help

Logged

Vejen, Denmark
Offline Offline
Edison Member
*
Karma: 9
Posts: 1178
RAWR! ^,..,^
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

inf loop would just be a

while(true) {}

or

for (;smiley-wink {}
Logged

captain-slow.dk | non contagious!

Nowhere
Offline Offline
God Member
*****
Karma: 3
Posts: 852
|-\ |\|\
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Haha, part of your for loop showed up as a smiley!
Logged

Soundcloud page: http://soundcloud.com/beefinator-2
Youtube channel: http://www.youtube.com/user/beefinator14
Old soundcloud page (ran out o

Pages: [1]   Go Up
Jump to: