WiShield 2.0 + Arduino Mega + MSTimer

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

WiShield 2.0 + Arduino Mega + MSTimer

Postby timvdp » Sun Oct 24, 2010 3:44 pm

Hello,

I installed a Wishield 2.0 on my Arduino Mega and got it working well. Now I want to add a timer in my sketch.
I can get my timer to work if I inhibit the WiFi.init() in my setup function. But I can't get both working at the same time.

I guess the WiShield 2.0 stack is messing with the interrupt, but I can't find any information on the subject.

Are there people here that got a simple timer working with the WiShield ?

Thanks for your help !

Note :
I am using Eclipse to build my project.
I tried to setup the timer 5 directly in my code, the issue is the same, it's working without the wishield.
timvdp
 
Posts: 4
Joined: Sun Oct 24, 2010 3:37 pm

Re: WiShield 2.0 + Arduino Mega + MSTimer

Postby GregEigsti » Sun Oct 24, 2010 5:33 pm

I regularly use MSTimer2 on a Duemilanove/WiShield and it works fine. I have also messed around and used different timers (namely the 16 bit timer on the 328) and that seemed to work fine - but I don't recall the details of that right now ;) I think it was part of the IR remote control code that was being worked on and documented on the forum.

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: WiShield 2.0 + Arduino Mega + MSTimer

Postby timvdp » Mon Oct 25, 2010 8:23 am

Thanks for the info. I had a look on the code and it seems it's using the PWM function of TimerOne.
I want to use the overflow interrupt of the timer (-> call an isr every x ms).

I think I got the wishield and the servo library working a few weeks ago, since the servo lib uses timers, it should work.
I'll try again tonight with the WiShield and a Servo.

If you have an example of the wishield and a timer ISR, let me know :)

Thanks for your help.

Tim
timvdp
 
Posts: 4
Joined: Sun Oct 24, 2010 3:37 pm

Re: WiShield 2.0 + Arduino Mega + MSTimer

Postby timvdp » Wed Oct 27, 2010 8:28 am

Apparently the issue was coming from Eclipse.
I cleaned my project, compiled the WiShield Library as a library in Eclipse and everything is working now.

Thanks for the help.
timvdp
 
Posts: 4
Joined: Sun Oct 24, 2010 3:37 pm


Return to Sketches and Applications

Who is online

Users browsing this forum: No registered users and 1 guest