02-16-2012 09:13 AM
Hi I'm looking for some help. I want the touch sensor when pressed to run a loop that causes 1 motor of the nxt to run moving a certain distance at a certain power and then stop. Then I want it to run again when the sensor is pressed (running the same loop) but only running on the press of the sensor when the sensors pressed. I have tried using a case structure and by putting the same circuit I the true and false case I thought it might work but it doesn't and it wasn't a very practical solution
Can you help??
Ailish
02-21-2012 08:57 AM
Hello Alish,
Thanks for using the forums.
Firstly I'd just like to clarify my understanding of your query. You have an NXT device connected to both a motor and a touch sensor, and when the touch sensor is pressed you would like the device to move forward a predefined amount. However for all subsequent presses, you would like some slightly different behaviour.
Could you please expand on the explanation of what you would like to happen after the first press? Also if you're able to attach the code which you have developed so far with comments explaining what you are trying to achieve, that would help greatly in my efforts to provide you with some pointers.
Kind Regards,
02-23-2012 05:44 AM
Hi Paul
Since I posted this I have changed my mind about what I am looking for the nxt to do. I will give you some background info an hopefully you can help.
Firstly I am using two NXT motors. The first one I have built an arm onto the motor, I want to move a set degree (egg 1degrees) at a set speed. As the NXT move further down( by 1 degrees ) it will apply pressure on a FSR. The FSR will be zero until the arm moves down(by 1degree) an applies the smallest pressure. But when the pressure on the FSR changes I want the DAQassist which is taking in the FSR signal to record the pressure applied at 1degree an output it to the user on the front panel showing the number. Then as the NXT moves down again the FSR resistance changes again and a new number is logged.. Is it possible to do this?? I will attach my code at present.
If I could get that working correctly it would be excellent
Secondly the other NXT motor has another arm built on it where I am placing an Accelerometer. I need this motor to move 180degrees at a speed of 20 forward and then move 180degrees at a speed of 60 (given a ratio of 3:1) backwards. carrying out this motion continuously. The accelerometer will also be attached to the DAQ and then I want the same DAQassist (because I tink you can only have one DAQassist per program) to out the accelerometers movement on a graph. Is this possible??
Thank you Ailish
02-24-2012 03:19 AM
Hi Alish,
For the sort of measurement process you explained, it sounds like the state machine architecture could be ideal for you explained here. You would be able to configure a state for moving the motor on 1 degree, which then passes to a measurement state to take a new DAQ reading, and repeats until a certain condition is satisfied.
As for outputting the accelerometer data to a graph, you should be able to simply read this from the output of the same DAQ Assistant.
Kind Regards,
02-24-2012 08:41 AM
Thanks Paul a state machine seems like the right way forward. But i dont know if i'm building it correctly. I am going to start only with the one NXT motor and the fsr. measuring the fsr after every move of the nxt. I'm having problrms coding tho can you take a look? This is a flowchart of what i'm trying to do
02-27-2012 05:10 AM
Hello,
In LabVIEW if you go to File > New and then pick the Standard State Machine Design Pattern under the Frameworks folder, if will open a template for you and explain how to use the architecture. I would use this as a starting point for your coding.
Reading the description of your project, it sounds like you will need a state to move the motor 1 degree and a state to check the FSR pressure and measure it if required. If you have limited experience with LabVIEW, I would highly recommend looking into our training courses. LabVIEW Core 1 covers these topics extremely well and will give you a good starting point for creating your LabVIEW programs.
Kind Regards,
02-27-2012 09:32 AM
Thanks I dont have much time left so I wont be able to do a training course. Is what i@m trying to do extremely difficult?? can you help me with some of the code?
02-27-2012 09:54 AM
Hi again,
The state machine is a relatively simple LabVIEW programming architecture and one of the first ones you would usually learn, unfortunately however I am unable to develop the code for you. If you open up the Standard State Machine template by going to File > New, it will give you the framework you need to get started with a bit of text explaining the different sections.
I'd also advise you to read the State Machine Design Pattern article and ensure you understand the concept correctly: http://zone.ni.com/devzone/cda/tut/p/id/3024
If you post back your attempt at developing the VI from the template, I'll be more than happy to make suggestions for you and guide you in the right direction.
Kind Regards,
02-28-2012 06:30 AM
So I have attached the code for the state machine but it wont move on to the 'Increase degree' or carry out the NXT code it is like its getting stuck. Do you know how to fix this?
03-06-2012 11:09 AM
Hello,
Please use the Standard State Machine architecture template - I have attached this in case you cannot load it from LabVIEW. This will give you the correct framework to begin writing your application from along with some instructions.