affichage v7

Fork of AFFICHAGE by Projet robot

Affichage.cpp

Committer:
fab16
Date:
2017-02-23
Revision:
6:82586f775dc5
Parent:
5:6834f15a1e48
Child:
7:8cadfcb7809f

File content as of revision 6:82586f775dc5:

#include "Affichage.h"



 m3pi m3piA;    
    
    void Affichage::bonjour(){
        m3piA.cls();
        m3piA.print("Bonjour",7);
        wait(1);
    }
    
    void Affichage::afficheResult(float result){
        m3piA.cls();
        m3piA.printf("%f",result);
        wait(1);
    }
    
    
    // affichage de 8 caractere max
    void Affichage::affichageCourt(char*message){
        m3piA.cls();
        m3piA.print(message,strlen(message));
        wait(1);
    }
    
    
    
    void Affichage::effacerTout(){
        m3piA.cls();
    }
    
    // teste affichage sur 2 ligne
    void Affichage::affichage2ligne(){
        m3piA.cls();
        m3piA.locate(0,0);
        m3piA.print("a",1);
        m3piA.locate(0,1);
        m3piA.print("b",1);
    }
    
    void Affichage::affichageUltrason(float distance){
        m3piA.cls();
        
        if(distance <= 0){
            m3piA.print("  Rien  ",8);
            m3piA.locate(0,1);
            m3piA.print(" en vue ",8);
            wait(1);
        }
        
        else{
            m3piA.locate(0,0);
            m3piA.printf("Obstacle");
            m3piA.locate(0,1);
            m3piA.printf(" %.1f cm",distance);
            wait(1);
        }
    }