GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Apr-2016, 12:00
premrishi premrishi is offline
New Member
 
Join Date: Apr 2016
Posts: 1
premrishi is on a distinguished road

Embedding two codes using if statement


hello, i am trying to connect the following two codes by is statement.
CPP / C++ / C Code:
#include // include the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int potPin = A0; //Potentiometer input pin
int potValue1 = 0;
int potValue2 = 0; // final display variable
void setup() {
lcd.begin(16, 2); // lcd rows and columns
lcd.print(“Potentiometer”); // title of sorts
}

void loop() {
// read then divide the input(max 1020 in this case) by 10
potValue1 = analogRead(potPin) / 10;
// divide by 1.02 to get percentage
potValue2 = potValue1 / 1.02;
// set cursor to second row, first column
lcd.setCursor(0, 1);
//display final percentage
lcd.print(potValue2);
//print the percent symbol at the end
lcd.print(“%”);
//wait 0.1 seconds
delay(100);
//wipe the extra characters
lcd.print(” “);
delay(1);
}
the next code is
CPP / C++ / C Code:
int timesTosend=1;
int count=0;
char phone_no[]=”87546165xxx”;
void setup()
{
Serial.begin(9600);
delay(2000);
Serial.println(“AT+CMGF=1″);
delay(200);
}
void loop()
{
while(count’);
{
Serial.print(“Test Message From Arduino GSM….HELLO..!!!”);
delay(500);
Serial.write(0x1A);
Serial.write(0x0D);
Serial.write(0x0A);
delay(5000);
}
count++;
}
}
the first code is based on displaying the potentiometer values as percentage in an lcd module

the second code is based on sending message by using gsm module

if the value of lcd read in the first code is 60% then it need to activate the second code
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OBHosting.com - 20GB Space | 200GB Bandwidth | Only 4.95$ with our 2 promotion codes OBH-Peter Web Hosting Advertisements & Offers 0 12-Jul-2013 03:28
We're looking for JavaScript codes / mini tutorials. JdS Web Design Forum 9 28-Feb-2011 02:53
Switch Statement Problem dontcare C++ Forum 3 14-Oct-2004 22:23
change statement jilshi Web Design Forum 0 26-Apr-2004 22:40
embedded C++ codes mak90thug C++ Forum 0 25-Jan-2004 22:50

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 10:09.


vBulletin, Copyright © 2000 - 2017, Jelsoft Enterprises Ltd.