- Netduino Forums
- → Geancarlo2's Content
Geancarlo2's Content
There have been 70 items by Geancarlo2 (Search limited from 08-May 23)
#26958 Working around lack of timezone on ND+
Posted by Geancarlo2 on 11 April 2012 - 07:45 PM in Netduino Plus 2 (and Netduino Plus 1)
#26545 What's wrong with my string array declaration?
Posted by Geancarlo2 on 05 April 2012 - 03:10 PM in General Discussion
You misunderstood my post because of the timingNot true, I have literally just created a jagged byte array for the project I am working on.
private byte[][] workBuffer = new byte[2][] { new byte[35], new byte[35]};
byte[,] is a multidimensional array
byte[][] is a jagged array
#26526 What's wrong with my string array declaration?
Posted by Geancarlo2 on 05 April 2012 - 12:36 PM in General Discussion
#37165 What About PICAXE for 1-Wire Support
Posted by Geancarlo2 on 14 October 2012 - 05:52 PM in General Discussion
#35753 timer question
Posted by Geancarlo2 on 22 September 2012 - 01:36 AM in Netduino 2 (and Netduino 1)
#31635 Target framework ?
Posted by Geancarlo2 on 05 July 2012 - 08:26 PM in Netduino Plus 2 (and Netduino Plus 1)
#41070 static bool
Posted by Geancarlo2 on 06 December 2012 - 02:23 AM in Netduino 2 (and Netduino 1)
These two methods are not equivalent. The last one only Reads once. Did you mean something like this instead, which is definitely way too verbose?
I think you missed the last line inside the loop since you tried to assign a bool to a delegate
#40379 static bool
Posted by Geancarlo2 on 28 November 2012 - 04:56 PM in Netduino 2 (and Netduino 1)
This does what you want:
public static void Method_7() { bool nutrientState = phcontroller.Read(); while (nutrientState == true) { a.Write(false); Thread.Sleep(5454); a.Write(true); b.Write(false); Thread.Sleep(3000); b.Write(true); Thread.Sleep(5 * MinuteMs); } }
phcontroller.Read() is a method call and returns a bool. nutrientState stores the value returned. When you compare it in "nutrientState == true", phcontroller.Read() is not called again, the value stored in nutrientState is used.
Note that the way it is coded, the loop will run forever until the thread is aborted.
#40383 static bool
Posted by Geancarlo2 on 28 November 2012 - 06:43 PM in Netduino 2 (and Netduino 1)
in that case you can create the variable outside the scope of the method.
static bool nutrientState = false;//initial value public static void Method_7() { nutrientState = phcontroller.Read();//read the port and assign result to nutrientState while (nutrientState == true)//run until nutrientState is set to false { a.Write(false); Thread.Sleep(5454); a.Write(true); b.Write(false); Thread.Sleep(3000); b.Write(true); Thread.Sleep(5 * MinuteMs); } }
Here it is a static class member and you can set it to false somewhere else. Of course if you set nutrientState to false while it is performing the stuff inside the loop, it'll complete it first and then check nutrientState - if this is not the behaviour you want, you must take a moment and rethink how to implement your logic.
#40422 static bool
Posted by Geancarlo2 on 29 November 2012 - 01:45 PM in Netduino 2 (and Netduino 1)
public static void Method_6() { while (phcontroller.Read() && method_state_6) { ph.Write(false); Thread.Sleep(1 * SecondMs); ph.Write(true); Thread.Sleep(5 * MinuteMs); } }
or +verbose:
public static void Method_6() { while (phcontroller.Read()==true && method_state_6 == true) { ph.Write(false); Thread.Sleep(1 * SecondMs); ph.Write(true); Thread.Sleep(5 * MinuteMs); } }
or ++(really unnecessary)verbose:
public static void Method_6() { bool phState = phcontroller.Read(); while (phState == true && method_state_6 == true) { ph.Write(false); Thread.Sleep(1 * SecondMs); ph.Write(true); Thread.Sleep(5 * MinuteMs); phState = phcontroller.Read(); } }
To be honest, I think you should study a good c# book before moving forward with your project... your questions are language/logic related. Don't let the difficulties discourage you, gather more knowledge and when you succeed it'll be even more gratifying.
#39646 Smartphone as control panel
Posted by Geancarlo2 on 19 November 2012 - 06:59 PM in Netduino Plus 2 (and Netduino Plus 1)
#39651 Smartphone as control panel
Posted by Geancarlo2 on 19 November 2012 - 08:05 PM in Netduino Plus 2 (and Netduino Plus 1)
#26223 simple code need help
Posted by Geancarlo2 on 01 April 2012 - 03:29 AM in Visual Studio
public static void Thread_5()
{
while (true)
{
controller.Write(false);
Thread.Sleep(1 * SecondMs);
controller.Write(true);
Thread.Sleep(10 * MinuteMs);
}
}
public static void Thread_6()
{
for (int i = 0; i < 14; i++)
{
Thread.Sleep(1 * DayMs);
solenoid.Write(false);
Thread.Sleep(20 * SecondMs);
solenoid.Write(true);
}
}
#26221 simple code need help
Posted by Geancarlo2 on 01 April 2012 - 02:56 AM in Visual Studio
public const int SecondMs = 1000; public const int MinuteMs = 60 * SecondMs; public const int HourMs = 60 * MinuteMs; public const int DayMs = 24 * HourMs; public const int WeekMs = 7 * DayMs; static OutputPort ph = new OutputPort(Pins.GPIO_PIN_D2, true); static OutputPort b = new OutputPort(Pins.GPIO_PIN_D3, true); static OutputPort a = new OutputPort(Pins.GPIO_PIN_D4, true); static OutputPort drain = new OutputPort(Pins.GPIO_PIN_D5, true); static OutputPort solenoid = new OutputPort(Pins.GPIO_PIN_D6, true); static OutputPort heater = new OutputPort(Pins.GPIO_PIN_D7, true); static OutputPort controller = new OutputPort(Pins.GPIO_PIN_D8, true); public static void Main() { drain.Write(false); Thread.Sleep(16 * MinuteMs); drain.Write(true); Thread tid_1 = new Thread(new ThreadStart(Thread_1)); Thread tid_2 = new Thread(new ThreadStart(Thread_2)); Thread tid_3 = new Thread(new ThreadStart(Thread_3)); Thread tid_4 = new Thread(new ThreadStart(Thread_4)); Thread tid_5 = new Thread(new ThreadStart(Thread_5)); Thread tid_6 = new Thread(new ThreadStart(Thread_4)); . . .
#26218 simple code need help
Posted by Geancarlo2 on 01 April 2012 - 01:50 AM in Visual Studio
static OutputPort blahblah=new OutputPort(etcetc);
you also forgot {} in Thread_5 and Thread_6
#27187 Serial Data Transfer Protocol problem
Posted by Geancarlo2 on 13 April 2012 - 09:30 PM in Netduino Plus 2 (and Netduino Plus 1)
#27193 Serial Data Transfer Protocol problem
Posted by Geancarlo2 on 13 April 2012 - 10:52 PM in Netduino Plus 2 (and Netduino Plus 1)
#26229 Redacted 00101100
Posted by Geancarlo2 on 01 April 2012 - 09:58 AM in General Discussion
#40292 Questions about Netduino+2, realtime and netmf
Posted by Geancarlo2 on 27 November 2012 - 08:26 AM in Netduino Plus 2 (and Netduino Plus 1)
1) correctSo for example if I am interested in this:
STM32F051R8T6 ARM Cortex-M0 32-bit microcontroller with 64KB of Flash memory
1) it is not enought to run netmf
2) if I want to develop on that cortex-m0 my only option is to buy expensive compiler suite + ide, for example Keil has the free limited to only 32kb. The first option is the "basic" @ 2000euros
correct?
so with netmf I spend a little more on CPU (Cortex M4 is 7$ for 1000pcs), but I save huge on IDE+tools?
2) wrong. You can go with the free and open alternative: gcc toolchain for arm + openocd + eclipse cdt. Just takes a little more work and knowledge to get things up and running. There are also other free "bundles", such as CoIDE(http://coocox.org/)
#35549 Question on a Circuit
Posted by Geancarlo2 on 19 September 2012 - 09:00 PM in General Discussion
#38123 Program in assembly language?
Posted by Geancarlo2 on 28 October 2012 - 04:45 PM in Netduino 2 (and Netduino 1)
#24563 Powering the Netduino
Posted by Geancarlo2 on 22 February 2012 - 05:19 PM in General Discussion
The datasheet says the modules uses 3mA with backlight off and about 60mA when it is on. The transistor can handle 1A in case you want to draw current through pin 15-explained on section "Hi-Current Control Pin".It's one of the serial-enabled LCD's on sparkfun. Here's it's datasheet. I was basing the power requirement on the statement: "Backlight transistor can handle up to 1A" I see no other indications of what it would need to draw.
#28847 Netduino Plus Reliability
Posted by Geancarlo2 on 11 May 2012 - 06:22 PM in Netduino Plus 2 (and Netduino Plus 1)
#28867 Netduino Plus Reliability
Posted by Geancarlo2 on 12 May 2012 - 03:35 AM in Netduino Plus 2 (and Netduino Plus 1)
#26259 Netduino Plus missing Classes under System.IO
Posted by Geancarlo2 on 02 April 2012 - 02:47 AM in Netduino Plus 2 (and Netduino Plus 1)
- Netduino Forums
- → Geancarlo2's Content
- Privacy Policy