pseudo-code scientific gara

Dependencies:   mbed HX711

main.cpp

Committer:
Alessio_Zaino
Date:
2019-09-11
Revision:
0:9e66b8d2ee5a

File content as of revision 0:9e66b8d2ee5a:

#include "mbed.h"
#include "HX711.h"
 PwmOut servo1(D3);
  PwmOut servo2(D5);
   PwmOut servo3(D6);

 
HX711 Balance1(D7,D13);       // Declaration
HX711 Balance2(D8,D13);       // Declaration
HX711 Balance3(D9,D13);       // Declaration
 
int main() 
{
    
    
    long value1,value2,value3;
    float weight,weight2,weight3;
        servo1.period(0.02f);
        servo2.period(0.02f);
        servo3.period(0.02f);
                    
    while (true) 
    {
                
                
                if(SEGNALE PER SCATOLA1){
                    servo1.pulsewidth(2200/1000000.0);//chiude box 1
                    value1 = Balance1.averageValue(100);
                    weight = (value1-11669475)/2450.0;         // I had to use the 788 value after testing with weight
                    //INVIARE WEIGHT
                    
                    
                    
                    
                    
                    }
                    
                    
                    
                    if(SEGNALE SCATOLA2){
                        servo2.pulsewidth(2100/1000000.0);//chiude box 2
                        value2 = Balance2.averageValue(100); 
                        weight2 = (value2-8506861)/940.0;   
                        
                        
                        
                        
                        }
                        
                        
                        
                    if(SEGNALRE SCATOLA3){
                        servo3.pulsewidth(2200/1000000.0);//chiude box 3
                        value3 = Balance3.averageValue(100);
                        weight3 = (value3-9923525)/1800.0;        
 
                        
                        
                        
                        
                        }
                   
}
    
}