Transmit & receive voltage value via HC-12 Wireless Module

hi! im a new beginner in the arduino. i get some problem in the coding that when the sensor show any voltage value they were not transmit and receive i guess, but for the transmit serial monitor they show voltage value , at receive serial monitor show nothing.sorry for my bad in english i hope yall can understand what im explained for :’( :’( :’(

transmit.txt (1.11 KB)

recieve.txt (872 Bytes)

This line does not make sense

if(Serial.available() <= 1022)

The maximum number of bytes that can be in the standard Serial Input Buffer is 64

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

…R

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

sorry for the thing that look like im a noob tho haha erghh. i just simply post and wanna quick answer for my problem . okay so here’s the code. for some reason i have make a little changed but im not sure if i look like noob person again :roll_eyes: :roll_eyes: :roll_eyes:

TRANSMIT

#include<SoftwareSerial.h>

SoftwareSerial mySerial(2 , 3 );//RX,TX

const int analogInPin = A0;//Analog input pin to the potentiometer
const int analogInPin1 = A1;


// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  pinMode(A0,INPUT);
  pinMode(A1,INPUT); 
  Serial.begin(9600);
  mySerial.begin(9600);
  
}


// the loop routine runs over and over again forever:
void loop()
{
int sensorValue1 = analogRead(A0) ; //value read from the pot
int sensorValue2 = analogRead(A1) ;
float voltageValue1 = sensorValue1 * (5.0 / 1023.0); //value outputto the PWM(analog out)
float voltageValue2 =  sensorValue2 * (5.0 / 1023.0);

 Serial.print("\n\nsensor1 = ");
 mySerial.println("\n\nsensor1 = ");
  
  Serial.print(sensorValue1);
  mySerial.println(sensorValue1);
  
  Serial.println("\t\t voltage1 = ");
  mySerial.println("\t\t voltage1 = ");
  
  Serial.println(voltageValue1);
  mySerial.println(voltageValue1);
  
  Serial.print("\n\nsensor2 = ");
  mySerial.println("\n\nsensor2 =");
  
  Serial.print(sensorValue2);
  mySerial.println(sensorValue2);

  Serial.println("\t\t voltage2 = ");
  mySerial.println("\t\t voltage2 =");

  Serial.println(voltageValue2);
  mySerial.println(voltageValue2);


  
 delay(1000);        // delay in between reads for stability
    }

RECEIVE

for receive it just doesnt have output just have to make it appear at serial monitor and show voltage value and sensor value from transmit.

#include<SoftwareSerial.h>

SoftwareSerial mySerial(2 ,3 );//RX,TX

void setup() {
  mySerial.begin(9600);
  Serial.begin(9600);
}

void loop ()
{
  if(Serial.available() > 0){
    int input = Serial.parseInt();
    mySerial.println(input);    
  }
 
  if(Serial.available() > 1){
    float input = mySerial.parseFloat();
    Serial.println(input);    
  }
  delay(20);
}

Nobody is going to unzip a file to look at it.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

Imtheperson97:
for receive it just doesnt have output just have to make it appear at serial monitor and show voltage value and sensor value from transmit.

Have you carefully studied the code in the link I gave you?

...R

TomGeorge:
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

Robin2:
Have you carefully studied the code in the link I gave you?

...R

yaaa im still study about it even some of it i cannot understand but i will refer my lecturer .

Imtheperson97:
even some of it i cannot understand

If you don't tell me what you don't understand then I can't help.

...R