affichage v7

Fork of AFFICHAGE by Projet robot

Affichage.cpp

Committer:
fab16
Date:
2017-03-02
Revision:
7:8cadfcb7809f
Parent:
6:82586f775dc5
Child:
8:80a4449820ac

File content as of revision 7:8cadfcb7809f:

#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 >= 250){
            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);
        }
    }