Hi I thought the serial monitor would read the bluetooth module but I cannot get anything. Works fine via the usb port 4.
#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 3;
const int LOADCELL_SCK_PIN = 2;
unsigned long startMillis;
unsigned long currentMillis;
unsigned long startExercise;
unsigned long endExercise;
const unsigned long exerciseTime =60010UL;
const unsigned long period =100UL;
unsigned int amount = 0;
unsigned int highest =0;
unsigned int total = 0;
unsigned int ExerciseTime = 0;
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
Serial.println("GET READY");
startMillis = millis();
delay(5000);
startExercise = millis();
}
void loop() {
endExercise = millis();
currentMillis = millis();
if (endExercise - startExercise <= exerciseTime){
if (currentMillis - startMillis >= period){
startMillis = currentMillis;
if (scale.is_ready()) {
long reading = scale.read();
//Serial.print("HX711 reading: ");
amount = map (reading,-440000,400000,0,255);
if (highest <= amount){
highest = amount;}
ExerciseTime = endExercise - startExercise;
total = total + amount;
Serial.print("time""\t");
Serial.print(ExerciseTime/1000);
Serial.print("\t");
Serial.print("highest value: ");
Serial.print(highest);
Serial.print("\t""total value: ");
Serial.println(total);
} else {
Serial.println("FAULT");
}
}
//delay(10);
}}
thanks for looking. Matt
Hi I thought the serial monitor would read the bluetooth module but I cannot get anything. Works fine via the usb port 4.
Please explain more. What bluetooth module? How is it connected to the Arduino? What is the monitor supposed to read from the module?
How is the bluetooth transmission received by the PC? Is there a dongle on the PC or some built in bluetooth adaptor? What port is it connected to? Does the BT app on the PC pair and connect with the module?
You may need to use a Serial terminal app (and not the ide serial monitor) to read BT transmissions to a PC.
Mattmanning:
Hi I thought the serial monitor would read the bluetooth module but I cannot get anything. Works fine via the usb port 4.
I usually pair HC-05 with a smartphone. Then use a Bluetooth terminal app to send text to HC-05.
.
It appears that you are trying to send data from Arduino to serial monitor on PC via Bluetooth. If that is the case, forget it. Your problem is that Serial monitor only talks to Arduino, via whatever COM port Arduino is on, while PC's Bluetooth is on some other port.
Solution: use a proper terminal programme, like Realterm, that can connect to the COM port that Bluetooth is on. RealTerm is a freebie, and there are several others like it. It also enables recording, and can timestamp the data using the PC's clock.
Hi Nick.
It's possible to communicate between the IDE monitor and a Bluetooth connected to an Arduino board. I'm doing just that right now.
The PC has to be already paired to the actual BT module. It will appear in the IDE list of ports as a pair of COM ports.
John.
OK, thank you. It sounds like you are using a newer IDE than me. If that is the case, I hope mattmanning is doing then same. I would imagine that using a proper terminal is still a better bet, but maybe not...