Understanding Boolean Data Types and Using the Boolean NOT (!) operator to Switch Arduino Pin States

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ •

  • @programmingelectronics
    @programmingelectronics  4 роки тому +2

    ****If you like this, I think you'll like the premium Arduino training we offer. You can check it out here**** bit.ly/3lHyzcB

  • @ishsiriram8286
    @ishsiriram8286 4 роки тому +2

    Thank you for your explanation, makes the bool function much more clear to me. Ish - South Africa

  • @daywidjc
    @daywidjc 10 років тому +3

    It's so much easier learning this material in bite sized pieces, Another video well done. Thanks Michael.

  • @JahanZeb1976
    @JahanZeb1976 10 років тому +6

    Excellent video on basic programming concept! Great work. Regards,

  • @joshuapitong899
    @joshuapitong899 2 роки тому +1

    Always a great help. Thank you 🙌

  • @MrVishalarwade
    @MrVishalarwade 2 роки тому +1

    Excellent !! Thank you sooooo much 🙏🏻

  • @CristianCSanta
    @CristianCSanta 3 роки тому +2

    This video is really helpfull thank you so much...

  • @015digambarsharma4
    @015digambarsharma4 4 роки тому

    Thanks Man. It was really confusing.

  • @attalaw36
    @attalaw36 4 роки тому +1

    thanks

  • @TGFMusic
    @TGFMusic 4 роки тому +1

    Holy hell this was almost 6 years ago.. so i expect no reply but, why on earth would I want to do all of this instead of making "int" or something else, and after the delay simply putting a "!" with the "int" ... basically what makes boolean any different than another variable? Or is it just because it can literally only be on or off so it is easier to understand for simple tasks?

  • @shereifwagdi7558
    @shereifwagdi7558 4 роки тому +1

    Thanks!

  • @sauravprashar
    @sauravprashar 6 років тому

    Got it and we can also make a simple home automation system

  • @tirthrajgandhakwala6201
    @tirthrajgandhakwala6201 Рік тому

    Awesome!!

  • @gitagoswami6878
    @gitagoswami6878 5 років тому

    What about Strings??? are they true or false??

  • @sanvenganza77
    @sanvenganza77 6 років тому +1

    why cannot set boolean in arduino schedule? arduino dont understand that comand.

  • @wonderwang1585
    @wonderwang1585 4 роки тому

    When you re using not-boolean why you not use delay?

  • @stig3081
    @stig3081 7 років тому +1

    Thx man!

  • @Ahm.ad_Ali
    @Ahm.ad_Ali 3 роки тому

    Thanks

  • @siddharthsinghrajawat3401
    @siddharthsinghrajawat3401 9 років тому +1

    Hello sir,i like your channel and it helped me to get started with arduino but im stuck at this Problem :
    my aim : i want to make a ldr to on and off an LEd (like a TV).
    what i coded :
    int led = 9;
    int ldr = A0;
    const int on = 700;
    const int off = 600;
    void setup() {
    pinMode(led,OUTPUT);
    pinMode(ldr,INPUT);
    Serial.begin(9600);
    }
    void loop() {
    int value = analogRead(ldr);
    Serial.println(value);
    switch (value) {
    case on :
    digitalWrite(led,HIGH);
    break;
    case off:
    digitalWrite(led,LOW);
    break;
    default:
    break;
    } }
    my obervation with ldr = max value 1023 and min value 500 at A0
    Now my problem is "data type" as we all know ldr value will change i want to know that is there any data type which stores value from one range to another like (ex. 500-700 for ON ) and (700-1023 for off) .. or this is not possible with LDR
    it is still working though but i have to be fast as value must be equal to what i have specified (const int on and const int off ) .
    TV uses IR which have specific values but still its chellenging to do it with ldr

    • @programmingelectronics
      @programmingelectronics  9 років тому +1

      +Siddharth Singh Rajawat Great question - you should check out this function, called map(), it might solve your problem.
      www.arduino.cc/en/Reference/Map
      Best of luck!

  • @qwezxc23456
    @qwezxc23456 8 років тому

    Thanks sir.

  • @syazwiazharsarkawi4433
    @syazwiazharsarkawi4433 8 років тому

    hai sir, can u pardon me to create one coding for our final project. my project about the fluorescent lamp. we use arduino uno. in this case, i need to create using boolean because my project is connect via webpage and actual switch. the probably right now is if i use both function, my relay got burn if i switch on lamp using webpage and switch off using actual switch. i need u response asap. sorry if my english very poor

  • @parallaxgenesis365
    @parallaxgenesis365 8 років тому

    sir, how can you make a blink proportional to the serial data from processing? what i mean is, i wanted to have just a single blink per pixel of x axis in processing on each time i move. what i wanted to do is, i wanted to make the blink function of my led like of that of servo that it has corresponding steps, but instead if steps, i wanted it to have a blink per pixel i move with my gui in processing. but i dont know how to set a "map" like for example from 0pixel in x axis o a maximum of 366pixels is from 0 blink state of led to 366. i hope you get what i mean. pls help me figure this out ^_^

  • @basimpsn
    @basimpsn 10 років тому +1

    Enjoy your videos very entertaining (beating a dead horse lol) Question do I have to download a Boolean Library? because my IDE for my arduino due don't recognize this code.

    • @programmingelectronics
      @programmingelectronics  10 років тому

      basimpsn You should have to download a library for using Boolean data types. Are you getting any specific errors when you compile the code?

  • @taranagnew436
    @taranagnew436 6 років тому

    i got a LCD keypad shield on top of my arduino and i want to be able to press the select button on the LCD keypad shield to generate random numbers, the problem i'm having is "when i go press the select button, nothen happens, plz help and here is my code
    #include
    #include
    // this is factory config shield initialisation
    LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
    // initialise the keypad
    DFR_LCD_Keypad keypad(A0, &lcd);
    int lcd_key = 0;
    int abc_key_in;
    #define btnSELECT 4
    int read_LCD_buttons;
    int diceOne;
    int diceTwo;
    define btnSELECT 4
    int read_LCD_buttons()
    {
    abc_key_in = analogRead(0);
    if (abc_key_in < 790) return btnSELECT;)
    void setup() {
    lcd.begin(16, 2);
    lcd.setCursor(0, 0);
    lcd.print("Press to dice");
    pinMode (A0, INPUT);
    }
    void loop() {
    lcd_key = read_LCD_buttons();
    switch (lcd_key)
    {
    case btnSELECT{
    diceOne = random(1, 7);
    diceTwo = random(1, 7);
    if (diceOne + diceTwo == 7) {
    lcd.clear();
    lcd.setCursor(7, 0);
    lcd.print("7");
    lcd.setCursor(3, 1);
    lcd.print("The pirate");
    if (diceOne + diceTwo == 5, 4, 3, 2, 6 ) {
    lcd.clear();
    lcd.setCursor(7, 0);
    lcd.print("5,4,3,2,6");
    if (diceOne + diceTwo == 3,2,1,5,4,6) {
    lcd.clear();
    lcd.setCursor(7, 0);
    lcd.print("fish");
    }
    }
    }
    }
    }

  • @bdtech6400
    @bdtech6400 3 роки тому

    Arduino titurial link my halp mi

  • @snaprollinpitts
    @snaprollinpitts 10 років тому +1

    okay, the dead dog has been officially kicked!
    you should've had the horse bone fall apart and hit the floor.
    be careful, that kind of bouillon with water can cause cancer to an arduino board