G2A Many GEOs
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "mbed.h"
  2. #include "C12832.h"
  3.  
  4. C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11);
  5. AnalogIn ainOTPOR(p15);
  6. AnalogIn ainNAPON(p16);
  7. DigitalIn tasterNAPON(p8);
  8. DigitalIn tasterOTPOR(p9);
  9.  
  10. int main() {
  11.     float otpor = 0;
  12.     float napon = 0;
  13.     int kontrola = 0;
  14.     float struja = 0.00033;
  15.     while (1) {
  16.         otpor = ainOTPOR.read()*3.3/struja;
  17.         napon = ainNAPON.read()*3.3;
  18.         lcd.locate(0,3);
  19.         if(kontrola == 0){
  20.             lcd.cls();
  21.             lcd.printf("Napon na ulazu je %f V",napon);
  22.         }else if(kontrola == 1){
  23.             lcd.cls();
  24.             lcd.printf("Otpor na ulazu je %f Ohma",otpor);
  25.         }
  26.         if(tasterNAPON) kontrola = 0;
  27.         else if(tasterOTPOR) kontrola = 1;
  28.         wait_ms(500);
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top