Netduino ability / multithreading - General Discussion - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino ability / multithreading


  • Please log in to reply
3 replies to this topic

#1 verschickter

verschickter

    New Member

  • Members
  • Pip
  • 2 posts

Posted 28 December 2013 - 01:23 PM

Hello,

normally, I´m not the type of guy who registers on a forum and instantly posts a question like this but I already wasted half a year and I´m really stuck with what I try to do.

 

Setup is like this:

 

Win7 machine connects to ArduinoMega board via usb/serial.

C# code running on win7 provides objects like pump, motor (PWM), linear actor, servos with predefined parameters (like speed, runtime, porttype) and also objects like sensors, buttons, switches.

 

I then run a parameterized thread start and call a method on the object that uses it´s properties as parameters.

(blink, fade, on, off, random, pulse, record input)

I made some changes to the firmata firmware on the arduino board and call it´s static arduino object (arduino.) on each thread.

The problem is, I want to run a predefined script of commands on the board when it´s offline (usb not connected) and that´s where the arduino becomes a pain.

 

Now, I´m asking myself if I could use Netduino and let the board handle the different methods for each port and just call those methods over serial connection from the win7 machine and otherwhise load a script to interpret commands and run it when it´s not connected via usb.

 

Calls from the win7 machine should look like

netduino.Ports.PWM[0].FadeUp(int speed, int resolution)

netduino.Ports.PWM[1].Blink(int blinkcount, int blinkpause, int blindurance);

 

So my questions are:

 

1) Is a netduino fast enough to run different programs on each pwm port smoothly (6 ports, update rate 200ms max) and still have some time left to read and set other ports over serial connection via the win7 machine or do some other stuff.

 

2) A netduino only provides 3.3V, so I suppose my 5V relais shields and the PWM shield I made, is useless if I port over to netduino (I read somewhere you can still use 5V shields from arduino??)

 

3) Is there an existing project like firmata, only for netduino so I can communicate between netduino and any c# program?

 

4) If a hardware interupt occurs, will it affect the threads, too or will there be another thread where the interupt method is called

 

5) Can I use a SD card to store some values so that when netduino looses power it can resume where it was?

 

Thank you for your time, I hope my english is ok

Greets, verschickter



#2 Mark Anderson

Mark Anderson

    Member

  • Members
  • PipPip
  • 25 posts
  • LocationChciago

Posted 29 December 2013 - 12:45 AM

Hi Geert

 

I just read this book and it answered all my questions about threading and interrupts.

It's excellent

 

http://www.amazon.co...k/dp/B006UZUCEI

 

Yes you can use the SD card. There are two sections on it in the book.

 

Regards

 

Mark



#3 verschickter

verschickter

    New Member

  • Members
  • Pip
  • 2 posts

Posted 29 December 2013 - 11:23 AM

Hey Mark,

I took a look on the book ( :rolleyes:) and under your Amazon review, that you made yesterday, I read the following:

 

 

Example are not explained properly, missing details of api and it's parameter. No real world examples. Most examples end up in turning LED light on/off, or sending output through debug port. ADC chapter is worthless as it won't show how to process continuous analog signals. Chapter for GUI doesn't show how to use real screen. Instead it demonstrates using emulator. Repetitive examples: Author has consumed (wasted) lot of pages to show same example for different platform. Author has failed to show beauty of writing code in C#. Code feels like C++, as no proper C# naming conventions are used.

 

That doesn´t sound to good, but I will search for a preview or something alike. Can you tell me something about the speed of netduino, is it capable of what I want to do?



#4 Mark Anderson

Mark Anderson

    Member

  • Members
  • PipPip
  • 25 posts
  • LocationChciago

Posted 29 December 2013 - 04:32 PM

The only valid point I think he makes is that there's a lot of repetition because he covers 3 platforms. It's not a netduino book it's a .net mf, so if he covered just one platform it would have limited appeal. As for his comments about using the emulator for examples, that's a plus in my book, as it means I can use the examples without having same hardware as author The kindle sample is very long, so download that and read it., if you want to get a feel for it I stand by my review. IMO it's one of the best tech books I've read. I was looking for more info on interrupts and threading and there's a good chunk on that the section on SPI is very detailed too and this uses a physical 2x16 display. Isn't there a way to lend kindle books now? I'd be happy to lend if you can figure out what I need to do. Regarding your question about the speed, I'm not sure I haven't got mine yet. Arrives tomorrow. From my memory of what I read in the book, the scheduler will switch between threads every 20ms. Interrupts are queued in the order they arrive, but you will lose them if they come at a very high rate. You can however get the interrupt details and queue yourself. The book covers this area very well.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.