2) Yes, you can remove that label. And put anything you need there. That's the purpose of my example.
3) I put those buttons there because you drew them in your hand drawing. Do with them as you please. You can even remove them, it will not affect the graphic bar.
4) Exactly. This was answered also in 3).
Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.
The bars are updated using the procedure block I explained before. It's self explanatory if you have a basic understanding of App Inventor.
In your case, please follow the tutorials first and then you will be able to understand how to implement the example.
//Saline Level Alert Program
// Hx711.DOUT - pin #A2
// Hx711.SCK - pin #A3
#include <Hx711.h>
#include "LedControl.h"
Hx711 scale(A2,A3);
int buzzer=9;
int selectPin = 8; // select the input pin for the toggle switch
int ledPin500 =10; // select the pin for the LED
int ledPin100 =11;
int val = 0; // variable to store the value coming from the sensor
int volume=500;
LedControl lc=LedControl(5,7,6,0); // Pin 5 to Data In, 7 to Clk, 6 to LOAD(orCS)
void setup(){
Serial.begin(9600);
pinMode(buzzer,OUTPUT);
pinMode(ledPin100, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(ledPin500,OUTPUT);
pinMode(selectPin,OUTPUT);
digitalWrite(buzzer,0);
lc.shutdown(0,false);// turn off power saving, enables display
lc.setIntensity(0,0);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
}
void loop() {
val = digitalRead(selectPin); // read the value from the select pin
// Serial.println(val);
// int volume=0;
float weight = scale.getGram();
if(weight<0)
{
weight=0;
}
Serial.print(weight,1);
delay(10000);
Serial.println("");
//Serial.print(scale.getGram(), 1);
// Serial.println(" g");
if(val==0) //if((weight>=15)||val==0)
{
volume=100;
Disp_Data100();
digitalWrite(ledPin100, HIGH); // turn the ledPin on
if ((weight<=160)&&(weight>=110))
{
// lc.setChar(0,4,'F',false);
lc.setChar(0,3,'H',false);
lc.setDigit(0,2,1,false);
lc.setDigit(0,1,6,false);
lc.setChar(0,0,'H',false);
}
else if ((weight<110)&&(weight>=80))
{
// lc.setChar(0,4,'H',false);
lc.setChar(0,3,'H',false);
lc.setChar(0,2,'A',false);
lc.setChar(0,1,'L',false);
lc.setChar(0,0,'F',false);
}
else if (weight<80)
{
lc.setChar(0,3,'L',false);
lc.setChar(0,2,'E',false);
lc.setDigit(0,1,5,false);
lc.setDigit(0,0,5,false);
}
else if ((weight<80 && weight>77)||(weight<65 && weight>45))
{
digitalWrite(buzzer,HIGH);
// lc.setChar(0,4,'L',false);
}
else
{
digitalWrite(buzzer,LOW);
}
}
else
{
digitalWrite(ledPin100, LOW);
} // stop the program for some time
if(val==1)
{
volume=500;
digitalWrite(buzzer,0);
Disp_Data500();
digitalWrite(ledPin500, HIGH); // turn the ledPin on
digitalWrite(ledPin100,LOW);
if ((weight<=555)&&(weight>=350))
{
// lc.setChar(0,4,'F',false);
lc.setChar(0,3,'H',false);
lc.setDigit(0,2,1,false);
lc.setDigit(0,1,6,false);
lc.setChar(0,0,'H',false);
}
else if ((weight<350)&&(weight>=110))
{
// lc.setChar(0,4,'H',false);
lc.setChar(0,3,'H',false);
lc.setChar(0,2,'A',false);
lc.setChar(0,1,'L',false);
lc.setChar(0,0,'F',false);
}
else if((weight<110))
{
// lc.setChar(0,4,'L',false);
lc.setChar(0,3,'L',false);
lc.setChar(0,2,'E',false);
lc.setDigit(0,1,5,false);
lc.setDigit(0,0,5,false);
}
else if ((weight<110 && weight>105)||(weight<80 && weight>50))
{
digitalWrite(buzzer,HIGH);
}
else
{
digitalWrite(buzzer,0);
}
}
else
{
digitalWrite(ledPin500, LOW);
}
}
void Disp_Data100(){
int ones, tens,huns;
ones = 0;
tens = 0;
huns=1;
lc.setDigit(0,7,(byte)huns,false);
lc.setDigit(0,6,(byte)tens,false);
lc.setDigit(0,5,(byte)ones,true);
lc.setChar(0,3,' ',false);
lc.setChar(0,2,' ',false);
lc.setChar(0,1,' ',false);
lc.setChar(0,0,' ',false);
}
void Disp_Data500(){
int ones,tens,huns;
ones = 0;
tens = 0;
huns=5;
lc.setDigit(0,7,(byte)huns,false);
lc.setDigit(0,6,(byte)tens,false);
lc.setDigit(0,5,(byte)ones,true);
lc.setChar(0,3,' ',false);
lc.setChar(0,2,' ',false);
lc.setChar(0,1,' ',false);
lc.setChar(0,0,' ',false);
}
/*net weight(full)
500ml= 555g,
100ml= 17g
net weight (half)
500ml= 350g
100ml= 11g
net weight (empty)
500ml= 10.5g to 10.2g(low buzzer) ,8g ,52g
100ml= 8g-7.7g ,6.5g ,42g
net weight (500ml) at threshold-1*/
Set the clock to 1000 ms (1 second) or whatever you need it to be. That means the meters will update every n milliseconds. I hope this is helpful for you to start.
Try things, find out how to test blocks yourself. That's the best and most rewarding way to learn. And show us what you come up with.
The block which u gave for level updating what should i give there..
1) can i remove the block for slider in screen1 which i have rounded?
Once check my blocks for auto read and updating level , bluetooth for both the labels
1)I gave label3 for the value from bluetooth of level upadtion
2) label4 for value from bluetooth for 100 ml level updation
3) label 5 message given from bluetooth for autoread out
4) label 6 message from bluetooth for autoread out
How to update the bars levels: I also showed you and explained before that in the procedure UPDATE_METER, the parameters are only 2: Meter number (1 or 2) and value received from Bluetooth for that meter. That will update the bars levels. Please read and re read the previous answers.
Honestly I don't know how else I can make it more clear. Start by fixing those duplicates Ghica pointed to you. Don't ask if this or that will work. Try it by yourself first. Don't be afraid of trying. That's how everyone here learned.
I will get the bluetooth values into the labels3 and label4 for the indication of saline level
Instead of numbers please tell how to send bluetooth values into procedure.