-4
In short, every time I send an AT command to my HM-10 bluetooth module, it returns nothing.
I don’t know what to do, the connection seems to be right, I don’t have a 2k resistor, so I’m using a level converter in bluetooth RXD, 5v in Vcc and GND-GND
when I hold the button, I get an error message:
Exception in thread "AWT-Eventqueue-0" java.lang.Nullpointerexception at Processing.app.Serial.write(Serial.java:226) at Processing.app.Serial.write(Serial.java:246) at Processing.app.Serialmonitor.send(Serialmonitor.java:121) at Processing.app.Serialmonitor.lambda$new$1(Serialmonitor.java:65) at javax.swing.Abstractbutton.fireActionPerformed(Abstractbutton.java:2022) at javax.swing.Abstractbutton$Handler.actionPerformed(Abstractbutton.java:2348) at javax.swing.Defaultbuttonmodel.fireActionPerformed(Defaultbuttonmodel.java:402) at javax.swing.Defaultbuttonmodel.setPressed(Defaultbuttonmodel.java:259) at javax.swing.plaf.basic.Basicbuttonlistener.mouseReleased(Basicbuttonlistener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.Jcomponent.processMouseEvent(Jcomponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.Lightweightdispatcher.retargetMouseEvent(Container.java:4904) at java.awt.Lightweightdispatcher.processMouseEvent(Container.java:4535) at java.awt.Lightweightdispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.Eventqueue.dispatchEventImpl(Eventqueue.java:760) 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$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:74) at java.security.Protectiondomain$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:84) at java.awt.Eventqueue$4.run(Eventqueue.java:733) at java.awt.Eventqueue$4.run(Eventqueue.java:731) at java.security.Accesscontroller.doPrivileged(Native Method) at java.security.Protectiondomain$Javasecurityaccessimpl.doIntersectionPrivilege(Protectiondomain.java:74) at java.awt.Eventqueue.dispatchEvent(Eventqueue.java:730) at java.awt.Eventdispatchthread.pumpOneEventForFilters(Eventdispatchthread.java:205) 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)
someone could help me?
I’m using that website as a reference:
EDIT: No use null nowhere in the program, it’s a Serial-In, Simple Serial-Out:
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
if (Serial.available()) {
int inByte = Serial.read();
Serial1.write(inByte);
}
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
}
On another PC works just right, already on my error machine, and I do the same thing on both
Does this Answer your Question? What is Nullpointerexception and what are its main causes?
– Piovezan
The problem is that I am not using any programming, I simply compile an empty sketch and send "AT" on the IDE’s serial monitor, expecting response from the module itself, and end up getting this error
– kovalski