Question

I am posting a support question on the forum so I can answer it here to help out others that may have a similar problem.
 
"
I downloaded the latest analogshield library from git hub. I'm trying to get the following code to compile in MPIDE: 
 
#include <analogShield.h> //Include to use analog shield.
#include <SPI.h> //required for ChipKIT but does not affect Arduino
#include <SoftwareSerial.h>
// anndrews pins
SoftwareSerial rs(4,7); //rx,tx
// johns pins
//SoftwareSerial rs(2,3); //rx,tx
void setup()
{
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
 
Serial.begin(115200);
rs.begin(115200);
 
Serial.println("Test");
}
void loop()
{
 
}
 
Compile errors are:
 
In file included from C:mpidelibrariesSPI/SPI.h:16:0,
from C:mpidelibrariesanalogShield/analogShield.h:54,
from sketch_mar24a.cpp:1:
C:MPIDEhardwarepic32corespic32/avr/pgmspace.h:4:2: error: #error ******** This sketch or library uses AVR-specific code that may not work with the chipKIT platform. See this forum for more information on porting code to chipKIT [www.chipkit.org/forum/viewforum.php?f=7] ********
In file included from C:mpidelibrariesanalogShield/analogShield.h:54:0,
from sketch_mar24a.cpp:1:
C:mpidelibrariesSPI/SPI.h: In static member function 'static byte SPIClass::transfer(byte)':
C:mpidelibrariesSPI/SPI.h:56:3: error: 'SPDR' was not declared in this scope
C:mpidelibrariesSPI/SPI.h:57:12: error: 'SPSR' was not declared in this scope
C:mpidelibrariesSPI/SPI.h:57:19: error: 'SPIF' was not declared in this scope
C:mpidelibrariesSPI/SPI.h: In static member function 'static void SPIClass::attachInterrupt()':
C:mpidelibrariesSPI/SPI.h:63:3: error: 'SPCR' was not declared in this scope
C:mpidelibrariesSPI/SPI.h:63:11: error: 'SPIE' was not declared in this scope
C:mpidelibrariesSPI/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':
C:mpidelibrariesSPI/SPI.h:67:3: error: 'SPCR' was not declared in this scope
C:mpidelibrariesSPI/SPI.h:67:12: error: 'SPIE' was not declared in this scope
"
 
The errors are because the tools are trying to compile the Arduino side of the library.  I am curious why that is happening.    
 
I tried your code on my machine and did not have any compile issues so lets figure out what is going on.
 
My setup:
- Windows 7
- MPIDE 20140821
- latest version of the library here: https://github.com/mwingerson/analogShield
- chipKIT UNO32
 
What is your setup?  
 
Thanks for contacting us on this issue.
 
 

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0
I brought my windows 8.1 laptop to work today and tried your sketch with these results:

 

compiled without errors on old version of MPIDE with a fresh download of the library

 
compiled without errors on latest version of MPIDE with a fresh download of the library

 
The compile errors that you supplied indicate the tools have the wrong board selected.  Did you select your board with this drop down menu?

 
If this does not help then double-check that you have the latest library from my github not the link off of the product page.
 
 
Those two possibilities are the simple solutions.
 
Hope this helps.
 

 

Share this post


Link to post
Share on other sites
  • 0

I have the right board selected and the correct library. The problem seems to be with SPI.h. If I create a minimal script to blink port13 I can compile and download to the UNO 32 and it works just fine. But, then if I <include SPI.h> at the top of the same script I get the compile errors.

Share this post


Link to post
Share on other sites
  • 0

QuantumKid,

Glad I could help.  

As for broken code, I posted the original library on the product page and it worked fine then.  I am not sure what changed that caused the library to not compile but I have updated the library a little bit since then and it has all been on my github.  

I was going to get the latest version of the library on the product page but I may have forgotten to submit it.  Thanks for the reminder!

Marshall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now