Go Down

Topic: Serial Monitor works with FTDI but crashes with bluetooth Module (Read 638 times) previous topic - next topic

Cue2

Using a HC-05 bluetooth module I cannot enter commands with Serial Monitor (serial monitor hangs) but Tera Term seems to work with this script

Code: [Select]
char INBYTE;
int  LED = 13; // LED on pin 13

void setup() {
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
}

void loop() {
  Serial.println("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:");
  while (!Serial.available());   // stay here so long as COM port is empty   
  INBYTE = Serial.read();        // read next available byte
  if( INBYTE == '0' ) digitalWrite(LED, LOW);  // if it's a 0 (zero) tun LED off
  if( INBYTE == '1' ) digitalWrite(LED, HIGH); // if it's a 1 (one) turn LED on
  delay(50);
}


I've set the baud rate appropriately, I think I must have because tera term seems to work at that baud.
Any ideas? Alternatively is there a way of making tera term behave more like serial monitor? i.e inputting a string of commands which are sent when you press the return key.

Same thing here !
I have this simple program loaded onto the Arduino:
void setup() {
  Serial.begin(38400);
}

void loop() {
  Serial.println("Toto\n");
  delay(500);
}

And when I connect TeraTerm to the serial port corresponding to the Bluetooth module, I see the corresponding data appearing.
However when I close TeraTerm and try to use Arduino's SerialMonitor, I get:

processing.app.SerialNotFoundException: Serial port 'COM9' not found. Did you select the right one from the Tools > Serial Port menu?
   at processing.app.Serial.<init>(Serial.java:191)
   at processing.app.Serial.<init>(Serial.java:92)
   at processing.app.SerialMonitor.openSerialPort(SerialMonitor.java:207)
   at processing.app.Editor.handleSerial(Editor.java:2481)
   at processing.app.Editor$17.actionPerformed(Editor.java:665)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
   at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
   at java.awt.Component.processMouseEvent(Component.java:6263)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
   at java.awt.Component.processEvent(Component.java:6028)
   at java.awt.Container.processEvent(Container.java:2041)
   at java.awt.Component.dispatchEventImpl(Component.java:4630)
   at java.awt.Container.dispatchEventImpl(Container.java:2099)
   at java.awt.Component.dispatchEvent(Component.java:4460)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
   at java.awt.Container.dispatchEventImpl(Container.java:2085)
   at java.awt.Component.dispatchEvent(Component.java:4460)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
processing.app.SerialNotFoundException: Serial port 'COM9' not found. Did you select the right one from the Tools > Serial Port menu?
   at processing.app.Serial.<init>(Serial.java:191)
   at processing.app.Serial.<init>(Serial.java:92)
   at processing.app.SerialMonitor.openSerialPort(SerialMonitor.java:207)
   at processing.app.Editor.handleSerial(Editor.java:2481)
   at processing.app.Editor$17.actionPerformed(Editor.java:665)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
   at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
   at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1225)
   at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1266)
   at java.awt.Component.processMouseEvent(Component.java:6263)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
   at java.awt.Component.processEvent(Component.java:6028)
   at java.awt.Container.processEvent(Container.java:2041)
   at java.awt.Component.dispatchEventImpl(Component.java:4630)
   at java.awt.Container.dispatchEventImpl(Container.java:2099)
   at java.awt.Component.dispatchEvent(Component.java:4460)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
   at java.awt.Container.dispatchEventImpl(Container.java:2085)
   at java.awt.Component.dispatchEvent(Component.java:4460)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Any help would be really welcome !
Dan
http://trandi.wordpress.com

Go Up