Go Down

Topic: error:'PD7'not declared in this scope (Read 885 times) previous topic - next topic

_vbob

Aug 23, 2014, 06:48 am Last Edit: Aug 23, 2014, 09:53 am by _vbob Reason: 1
Hello,I`m trying to transfer some data from android to arduino,(my arduino is Arduino nuo R3, with a USB Host shield)
so i added two libraries:USB_Host_Shield and AndroidAccessory,and there is my code :
Code: [Select]
#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
#include <WProgram.h>
#define redPin 13


#define cycleTime 10

boolean randomMode = true;


AndroidAccessory acc("Simon Monk",
    "DroidLightShow",
    "Light Show Accessory",
    "1.0",
    "http://www.duinodroid.com/android",
    "0000000012345678");

void setup()
{
 Serial.begin(9600);
 pinMode(redPin, OUTPUT);
 acc.powerOn();
}

void loop()
{
 byte msg[3];
 if (acc.isConnected())
 {
   acc.read(msg, sizeof(msg), 1);
   if (msg[0] == 1) // set red
   {
     for(int i=0;i<5;i++){
       digitalWrite(redPin,LOW);
       delay(200);
       digitalWrite(redPin,HIGH);
       delay(200);
     }
   }
 }
 delay(cycleTime);
}

when I uploaded,there some errors.frist? the error is
Code: [Select]
In file included from sketch_aug23a.ino:1:
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield/Max3421e.h:37:22: error: WProgram.h: No such file or directory
I changed #include"WProgram.h" to #include"Arduino.h", maybe resolved the probelm,but there this a new .
Code: [Select]
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp: In static member function 'static void MAX3421E::setRST(uint8_t)':
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp:94: error: 'PD7' was not declared in this scope
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp:96: error: 'PD7' was not declared in this scope
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp: In static member function 'static uint8_t MAX3421E::readINT()':
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp:101: error: 'PB1' was not declared in this scope
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp: In static member function 'static void MAX3421E::pinInit()':
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp:113: error: 'PB1' was not declared in this scope
C:\Users\ACER\Documents\Arduino\libraries\USB_Host_Shield\Max3421e.cpp:114: error: 'PD7' was not declared in this scope

there is part of the Max3421e.cpp:
Code: [Select]
...
#if  defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
#define INT PB1
#define INT_PORT PORTB
#define INT_DDR DDRB
#define INT_PIN PINB

#define RST PD7
#define RST_PORT PORTD
#define RST_DDR DDRD
#define RST_PIN PIND

#define GPX PB0
#define GPX_PORT PORTB
#define GPX_DDR DDRB
#define GPX_PIN PINB
#endif
void MAX3421E::setRST(uint8_t val)
{
if (val == LOW)
RST_PORT &= ~_BV(RST);
else
RST_PORT |= _BV(RST);
}

...

(PD7  PB0  are  Pins of the AtmeGa328p)
how to sovle this ?

michinyon

It means it cannot find one or more of your .h files.

wprogram.h  is very obsolete and should be replaced with arduino.h

_vbob


It means it cannot find one or more of your .h files.

wprogram.h  is very obsolete and should be replaced with arduino.h

how can I know which    xxx.h file could not be found??

Go Up