johannp02180 Posted October 1, 2016 I am new to this blog and don't know how things work yet. I have a few questions about some programming I am having trouble with and wanted to see if the community can provide me with some programs they've built. 1. I want a program so that you can press the touch sensor ex. 2 times, it would run the 2nd program; press the touch sensor 4 times it would run the forth program etc. Or have a color sensor and I put a red brick in front of it and it runs a specific program. 2. I have a wall follower program and I am wondering if it can follow the wall for about 24in or so and then stop and do some other action. Does anyone have an idea on how to do this, and can you provide a program? I can't figure out how to program these. Any tips, programs, would help! Share this post Link to post Share on other sites
berrys66 Posted October 4, 2016 Have you worked through the EV3 tutorial on the lego web site? http://www.lego.com/en-gb/mindstorms/learn-to-program Share this post Link to post Share on other sites
johannp02180 Posted October 5, 2016 Yes, I have been using the ev3 program for a while now. I have been through that many times. Any programs you have done in the past I can look at? Share this post Link to post Share on other sites
berrys66 Posted October 5, 2016 I'm afraid I can't help with examples since I don't have an EV3. Multi-tasking on the NXT was relatively easy using the LejOS firmware since you could write multi-threaded java programs. There seem to be quite a few youtube videos on multi-tasking with the EV3 though. Share this post Link to post Share on other sites
xlib Posted October 6, 2016 On 10/2/2016 at 1:07 AM, johannp02180 said: I am new to this blog and don't know how things work yet. I have a few questions about some programming I am having trouble with and wanted to see if the community can provide me with some programs they've built. 1. I want a program so that you can press the touch sensor ex. 2 times, it would run the 2nd program; press the touch sensor 4 times it would run the forth program etc. Or have a color sensor and I put a red brick in front of it and it runs a specific program. 2. I have a wall follower program and I am wondering if it can follow the wall for about 24in or so and then stop and do some other action. Does anyone have an idea on how to do this, and can you provide a program? I can't figure out how to program these. Any tips, programs, would help! 1. You asked 2 questions: a)"press X times -> run X'th program" and b)"run the program depending on color sensor output". Answer for "b" is simple - you're just using "switch" block controlled by output of color sensor. Or maybe I'm missing something? Answer for "a", however, is more complicated. What you say "press button 2 times" what you actually mean is "time between press #1 and #2 is less then some threshold". So, you should build simple state machine here - touch sensor starting timer. Then you wait for timeout expiration or new button press. If timeout expired - act upon number of presses you counted. And yes, this is somewhat complicated, maybe i will come up with examples later. 2. This looks simple - just have another loop that counts distance and stop the motors (or do other action). Share this post Link to post Share on other sites
Jim Posted October 6, 2016 Hi Johan, Have you ever thought about getting a nice EV3 book? I know Laurens Valk has written a great boot. But there are some other ones out there which cover the basics pretty well. First of all you need to know how to start a program from a program. Second you will need to make a program which checks the detected color and makes a decision based on that color. Combine the two and you will have a program selector. Share this post Link to post Share on other sites
xlib Posted October 7, 2016 12 hours ago, Jim said: Hi Johan, Have you ever thought about getting a nice EV3 book? Or, alternatively, you can take a look at http://ev3lessons.com/index.html Share this post Link to post Share on other sites