Code Arduino
Code Arduino
<LiquidCrystal.h>
#include <Keypad.h>
int x;
#define BAUD (9600)
//variables declaration
boolean valOnePresent = false;
boolean next = false;
boolean final = false;
boolean calcul_termine = false;
String num1, num2;
int ans = 200;
int direction = 0;
char op;
void setup(){
pinMode(6,OUTPUT); // Enable
pinMode(5,OUTPUT); // Step
pinMode(4,OUTPUT); // Dir
digitalWrite(6, HIGH); // Set Enable low
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Debit Volumique");
delay(2000);
lcd.clear(); //clears the LCD screen and positions the cursor
in the upper-left corner.
Serial.begin(BAUD);
void loop(){
char key = myKeypad.getKey();
ans = num1.toInt()*425 ;
//1ml = 468pas et Dvmoteur = 0,2ml/s
}
lcd.clear();
lcd.setCursor(15,0);
lcd.autoscroll();
lcd.print(ans);
lcd.noAutoscroll();
calcul_termine = true;
valOnePresent = false;
final = false;
if (calcul_termine) {
//lcd.print(Saisir la direction:
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Direction");
key = NO_KEY;
while ( key == NO_KEY) {
key = myKeypad.getKey();
}
if (key == '+') {
direction = 1;
}
else if (key == '-') {
direction = 2;
}
}
if ((key != NO_KEY) && (key == 'X')){
lcd.clear();
valOnePresent = false;
final = false;
num1 = "";
num2 = "";
ans = 0;
op = ' ';
}
if (direction == 1){
lcd.clear();
lcd.print("Direction +ve");
}
MOTEUR ESSAI
#defin
e
pinEna
ble 13
//
Activa
tion
du
driver
/pilot
e
#define pinStep 9 // Signal de PAS (avancement)
#define pinDir 8 // Direction
void setup(){
Serial.begin(9600);
Serial.println("Test DRV8825");
void loop(){
int i = 0;
#incl
ude
<Step
per.h
>
#include <LiquidCrystal.h>
#include <Keypad.h>
//variables declaration
boolean valOnePresent = false;
boolean next = false;
boolean final = false;
String num;
int ans;
char op;
// FIN Moteur
const int stepsPerRevolution = 200; // change this
to fit the number of steps per revolution
// for your motor
void setup(){
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Debit Volumique");
delay(6000);
lcd.clear(); //clears the LCD screen and positions
the cursor in the upper-left corner.
} ////
void loop(){
char key = myKeypad.getKey();
// DEBUT MOTEUR
int i = 0;
//FIN MOTEUR
if (final == true && key != NO_KEY && key == '='){
Keypad
#incl
ude
<Keyp
ad.h>
const
byte ROWS
= 4;
const
byte COLS
= 4;
char
keys[ROWS
][COLS] =
{
{'1','2',
'3','A'},
{'4','5',
'6','B'},
{'7','8',
'9','C'},
{'*','0',
'#','D'},
};
byte
rowPins[R
OWS] =
{3,4,5,6}
;
//connect
to row
pinouts
byte
colPins[C
OLS] =
{7,8,9,10
};
//connect
to column
pinouts
Keypad
keypad =
Keypad( m
akeKeymap
(keys),
rowPins,
colPins,
ROWS,
COLS );
void
setup(){
Serial.be
gin(9600)
;
}
void
loop(){
char
key =
keypad.ge
tKey();
if (key
!=
NO_KEY){
Serial.pr
intln(key
);
}
}