Pages: [1]   Go Down
Author Topic: VGA library and WiFi library conflict?  (Read 480 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been using the VGA library for some graphics sketches I've been working with on the Due.  This has worked fine.

I decided I'd like to be able to control the VGA graphic display via WiFi.  I have a official Arduino WiFi shield that I've gotten working independently.  It took a bit of research in order to find out how to flash the firmware on the WiFi Shield to get it to work with IDE 1.5.3 and the Due, but it does work and transfers data back and forth across a socket connection.  I wrote a Java application to test it, and seems to work fine.

However, once I try to combine the VGA library and the Wifi Library into the same sketch, nothing seems to work.  No Serial output, no VGA output, no WiFi connection.  I assume there's either a DMA, SPI, or timer interrupt conflict.


This simple code does not work.  I'm not even accessing the WiFi or SPI libraries at all, but somehow just including them is causing the VGA library to quit working:

Code:
#include <WiFi.h>
#include <SPI.h>
#include <VGA.h>


void setup() {
  //Start the serial connection.
  Serial.begin(9600);

  //Start the VGA library at 320x240 resolution at 8-bit color.
  VGA.begin(320,240,VGA_COLOUR);
}//End setup


void loop() {

  //Fill the frame buffer.
  for (int y=0;y<240;y++)
  {
    for (int x=0;x<320;x++)
    {
      //Generate random color.
      byte color =random(255);

      //The serial calls make the VGA display very slow
      //but have this here to make sure it's working.
      Serial.print("(");
      Serial.print(x);
      Serial.print(",");
      Serial.print(y);
      Serial.print(") = ");
      Serial.println(color,HEX);

      //Draw the color on the screen.
      VGA.drawPixel(x,y,color);
    }  

  }


}//End loop

However, commenting out

Code:
#include <WiFi.h>

allows the VGA display to work correctly.

Any thoughts on what the conflict is here, or what could be done to work-around the problem?
« Last Edit: September 04, 2013, 08:11:32 pm by BKnight760 » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you might have to #include <WiFi.h> after SPI.h - that's what the other WiFi examples do. I can't help much as I haven't got an Arduino WiFi shield.

As for whether the two libraries will work together, VGA is very resource intensive, but WiFi isn't. Hopefully there's a good chance of getting them to work together somehow. I've had VGA working successfully with a WiFly but that just uses serial.
Logged


Pages: [1]   Go Up
Jump to: