- Netduino Forums
- → Asymptot's Content
Asymptot's Content
There have been 7 items by Asymptot (Search limited from 14-May 23)
#34491 Black line path
Posted by Asymptot on 31 August 2012 - 12:31 PM in General Discussion
#33813 Issue with DFRobot MotorShield 1A
Posted by Asymptot on 17 August 2012 - 09:21 AM in Netduino 2 (and Netduino 1)
#33784 Issue with DFRobot MotorShield 1A
Posted by Asymptot on 16 August 2012 - 03:45 PM in Netduino 2 (and Netduino 1)
#33779 Issue with DFRobot MotorShield 1A
Posted by Asymptot on 16 August 2012 - 03:12 PM in Netduino 2 (and Netduino 1)
#33773 Issue with DFRobot MotorShield 1A
Posted by Asymptot on 16 August 2012 - 02:18 PM in Netduino 2 (and Netduino 1)
I currently have this strange problem when I try to use the DFRobot MotorShield 1A (http://www.dfrobot.c...or_Shield_(L293)_(SKU:_DRI0001)) with my Netduino, still using the 4.1 firmware and framework :
When I use a dummy code like this :
while (true) { }
Both motors run (and if i don't plug any motor, the motor LEDs indicating motor activity are lit)
Nevertheless when i set the different PINs for more control, like this :
PWM E1 = new PWM(Pins.GPIO_PIN_D5); OutputPort M1 = new OutputPort(Pins.GPIO_PIN_D4, true); PWM E2 = new PWM(Pins.GPIO_PIN_D6); OutputPort M2 = new OutputPort(Pins.GPIO_PIN_D7, true); E1.SetDutyCycle(50); E1.SetDutyCycle(50);
Then, both motors run during the boot/loading phase, and then stop.
It seems to me that for some reason, bothmotors run by default, and trying to set PWM on them turn them off...
I have no idea why this is happenning.
Does anyone has an idea of why this is happenning?
#32664 Generic line detector class
Posted by Asymptot on 25 July 2012 - 04:58 PM in Netduino 2 (and Netduino 1)
while working on my line follower robot project, I had to make a class for reading the sensors of my line detector.
The idea is to read all sensors and send a grouped message to the main program in the form of an int.
I thought I'd make it as generic as possible for any sensor array that would use one digital input per sensor.
Here is the code :
/// <summary> /// This class represents the reflectance array - or line detector. /// I made it with the Parallax 8-reflectance sensors array in mind, but I'm trying to make it /// as generic as possible. /// </summary> class CLineDetector { private InputPort[] sensorArray; /// <summary> /// Represents the arrays of inputs used in the Netduino for the sensor array /// </summary> public InputPort[] SensorArray { get { return sensorArray; } set { value = sensorArray; } } private int arrayLength; /// <summary> /// Represents the numbers of sensors in the Line detector. /// </summary> public int ArrayLength { get { return arrayLength; } set { value = arrayLength; } } public CLineDetector() { } public CLineDetector(InputPort[] sensorarray) { sensorArray = sensorarray; } /// <summary> /// Reads all sensors and returns their grouped readings. /// </summary> /// <returns>A reading of the whole array</returns> public int ReadAll() { int iRes = 0; int iCount, iReading; //Reads all the sensors and put them all in a single int for (iCount = 0; iCount < sensorArray.Length; iCount++) { iReading = sensorArray[iCount].Read() ? 1 : 0; iRes += iReading << iCount; } // Put them in form return iRes; } }
I'm posting it for critics as to the generic-ness of the class, and also for two specific questions :
- It seems to me the SensorArray member really doesn't need to be public, since the rest of the program will only need to know the end result and the number of sensors. What do you think?
- The time factor, I didn't use any "sleep" in my "ReadAll" method, thinking it's more the main program's job. Am I right?
Thanks you for comments and critics :-).
#24471 Parallax Infrared Line Follower and Netduino
Posted by Asymptot on 20 February 2012 - 04:09 PM in Netduino 2 (and Netduino 1)
- Netduino Forums
- → Asymptot's Content
- Privacy Policy