Go Down

Topic: Arduino 1.0.3 Errors (Read 757 times) previous topic - next topic

Kpro81

Hi,

I bought an Arduino Mega ADK , and try to make simple sketch using the Arduino IDE.

But when I compile I get this message :

Code: [Select]

C:\Users\BipBip\Downloads\arduino-1.0.3-windows\arduino-1.0.3\libraries\UsbHost/AndroidAccessory.h: In function 'void setup()':
C:\Users\BipBip\Downloads\arduino-1.0.3-windows\arduino-1.0.3\libraries\UsbHost/AndroidAccessory.h:68: error: 'void AndroidAccessory::powerOn()' is private
sketch_jan11a:16: error: within this context
C:\Users\BipBip\Downloads\arduino-1.0.3-windows\arduino-1.0.3\libraries\UsbHost/AndroidAccessory.h: In function 'void loop()':
C:\Users\BipBip\Downloads\arduino-1.0.3-windows\arduino-1.0.3\libraries\UsbHost/AndroidAccessory.h:66: error: 'int AndroidAccessory::read(void*, int, unsigned int)' is private
sketch_jan11a:23: error: within this context


I don't know what I can do to resolve this problem.

There is my AndroidAccessory.cpp :

Code: [Select]

/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


#include <Max3421e.h>
#include <UsbHost.h>
#include <AndroidAccessory.h>

#define USB_ACCESSORY_VENDOR_ID         0x18D1
#define USB_ACCESSORY_PRODUCT_ID        0x2D00

#define USB_ACCESSORY_ADB_PRODUCT_ID    0x2D01
#define ACCESSORY_STRING_MANUFACTURER   0
#define ACCESSORY_STRING_MODEL          1
#define ACCESSORY_STRING_DESCRIPTION    2
#define ACCESSORY_STRING_VERSION        3
#define ACCESSORY_STRING_URI            4
#define ACCESSORY_STRING_SERIAL         5

#define ACCESSORY_GET_PROTOCOL          51
#define ACCESSORY_SEND_STRING           52
#define ACCESSORY_START                 53


AndroidAccessory::AndroidAccessory(const char *manufacturer,
                                  const char *model,
                                  const char *description,
                                  const char *version,
                                  const char *uri,
                                  const char *serial) : manufacturer(manufacturer),
                                                        model(model),
                                                        description(description),
                                                        version(version),
                                                        uri(uri),
                                                        serial(serial),
                                                        connected(false)
{

}

boolean AndroidAccessory::begin(void) {
 powerOn();
 return true; // For forward compatibility with v2.x of the library
}

void AndroidAccessory::powerOn(void)
{
   max.powerOn();
   delay(200);
}

There is more code , but nothing important...



Can you give me a way to clear these problems ?

PeterH


try to make simple sketch using the Arduino IDE.

But when I compile I get this message :

There is my AndroidAccessory.cpp :


Which .cpp file is compiling when the errors occur? It may not be the AndroidAccessory.cpp library implementation - perhaps it's a problem in the sketch itself. Which we can't see yet, by the way.
I only provide help via the forum - please do not contact me for private consultancy.

Kpro81

There is the sketch :

Code: [Select]


#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>
#define  LED_PIN  13
AndroidAccessory acc("Manufacturer",
"Model",
"Description",
"1.0",
"http://yoursite.com",
                "0000000012345678");
void setup()
{
  // set communiation speed
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  acc.powerOn();
}

void loop()
{
  byte msg[0];
  if (acc.isConnected()) {
    int len = acc.read(msg, sizeof(msg), 1); // read data into msg variable
    if (len > 0) {
      if (msg[0] == 1) // compare received data
        digitalWrite(LED_PIN,HIGH); // turn on light
      else
        digitalWrite(LED_PIN,LOW); // turn off light
    }
  }
  else
    digitalWrite(LED_PIN , LOW); // turn off light
}






I think the AndroidAccesory.h  included at the top uses the .cpp , no ?

PaulS

Quote
I don't know what I can do to resolve this problem.

What you can do is not use those private functions.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy