• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Błąd kompilacji - Atmega32 i NRF24L01
#1
Question 
Witajcie

Stworzyłem program na Arduino Pro Mini korzystający z HC-SR04 i NRF24L01. Wszystko działo poprawnie ale chciałem przerzucić program na Atmege32.
Skorzystałem z tego poradnika : KLIK
Program bez wstawek z bibliotekami NRF24L01 działa poprawnie i wgrywa się bez żadnego problemu.
Biblioteka dla NRF: KLIK
Po wpisaniu funkcji do komunikacji NRF wyskakują mi w konsoli takie o to komunikaty:

Kod:
java.lang.NullPointerException
    at processing.app.BaseNoGui.removeDescendants(BaseNoGui.java:944)
    at processing.app.BaseNoGui.removeDir(BaseNoGui.java:966)
    at processing.app.Base.removeDir(Base.java:2559)
    at processing.app.Sketch.saveAs(Sketch.java:706)
    at processing.app.Editor.handleSaveAs(Editor.java:2398)
    at processing.app.Editor.handleSave(Editor.java:2339)
    at processing.app.Editor.handleExport(Editor.java:2465)
    at processing.app.Editor$9.actionPerformed(Editor.java:577)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Opcje projektu zmienione, przeładuj całość
In file included from C:\Users\ATIV BOOK 5\Documents\Arduino\libraries\RF24-master/RF24.h:18:0,
                from sketch_mar10b.ino:3:
C:\Users\ATIV BOOK 5\Documents\Arduino\libraries\RF24-master/RF24_config.h:23:17: fatal error: SPI.h: No such file or directory
#include <SPI.h>
                ^
compilation terminated.
Multiple libraries were found for "nRF24L01.h"
Used: C:\Users\ATIV BOOK 5\Documents\Arduino\libraries\RF24-master
Not used: C:\Users\ATIV BOOK 5\Documents\Arduino\libraries\RF24
Błąd kompilacji.



PROGRAM:
Kod:
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>



#define trigpin 6
#define echopin 5
#define R 8
#define B 7

int LED = 8;
int Y = 1;


int msg[1];
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup()

{ //serial monitor and pin setup.

 radio.begin();
 radio.openWritingPipe(pipe);

  pinMode(trigpin,OUTPUT); //set trigpin as output
  pinMode(echopin,INPUT);//set echopin as input
  pinMode(R,OUTPUT);// set R,G and B as outputs
  pinMode(B,OUTPUT);

}
void loop()

{
   
 int duration, distance;//declare distance and duration as integers
 digitalWrite(trigpin,HIGH);// trigin send out signal
 _delay_ms(500);//coninously for 1000ms
 digitalWrite(LED,HIGH);//red led is off
 digitalWrite(trigpin, LOW);// then goes low
 
 duration=pulseIn(echopin,HIGH); // duration is the pulseIn to the echopin
 
 distance=(duration/2)/29.1; //  the 29.1 is used to convert the distnce to cm, the value varies for other units.

 
 if(distance > 10 && distance <= 20 ){//distcance is greater than 0 and less than 20cm
   LED = R;
   Y = 1;
 }
 
     if(distance < 10 || distance > 20 ){
     LED = B;
     Y = 2;
      }
      _delay_ms(200);
  digitalWrite(R,LOW);//red led is off
  digitalWrite(B,LOW);//red led is off
  msg[0] = Y;
  radio.write(msg, 1);  
}

Mogę prosić o jakieś porady?
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości