نمایش نتایج: از 1 به 10 از 27
Like Tree17 لایک

موضوع: ماژول سون سگمنت 4 رقمی همراه با درایور 74hc59

Hybrid View

  1. #1
    مدیر گروه
    تاریخ عضویت
    Nov 2013
    محل سکونت
    ایران
    نوشته ها
    4,064
    نقل قول نوشته اصلی توسط مهیار نمایش پست ها
    سلام


    اولین سوالم اینه که موارد زیر باید به کدوم پین ها وصل شن؟
    SCLK_pin

    RCLK_pin

    DIO_pin
    -------------------------------------

    فکر می کنم شما هدر کد رو مطالعه نکردید!
    کد:
    int latchpin = 5; 
    int clockpin = 7;
    int datapin = 6;
    float b = 0;
    int c = 0;
    float d = 0;
    int e = 0;
    int speed = 300; // used to control speed of counting
    int segdisp[10] = {3,159,37,13,153,73,65,27,1,9 };
    int digits[]= {128,64,32,16,8,4,2,1};
    void setup()
    {
      pinMode(latchpin, OUTPUT);
      pinMode(clockpin, OUTPUT);
      pinMode(datapin, OUTPUT);
      digitalWrite(latchpin, LOW);
      shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
      shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
      digitalWrite(latchpin, HIGH);
    
    
    }
    void loop()
    {
      setDigit(3,1);
    //  setDigit(1,5);
    //  setDigit(2,0);
      delay(10);
    }
    void setDigit(int dig, int character)
    {
    				   
    	digitalWrite(latchpin, LOW);
            shiftOut(datapin, clockpin, LSBFIRST, segdisp[character]);
            shiftOut(datapin, clockpin, LSBFIRST, digits[dig]);
    	digitalWrite(latchpin, HIGH);
            digitalWrite(latchpin, LOW);
            shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
            shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
            digitalWrite(latchpin, HIGH);
    }
    void shoop()
    {
      //  Count up
      for (int z=0; z<100; z++)
      {
        digitalWrite(latchpin, LOW);
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
        digitalWrite(latchpin, HIGH);
        if (z<10)
        {
          digitalWrite(latchpin, LOW);
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[z]); // sends the digit down the serial path
          shiftOut(datapin, clockpin, LSBFIRST, 255); // sends a blank down the serial path to push the digit to the right
          digitalWrite(latchpin, HIGH);
        }
        else if (z>=10)
        {
          d=z%10; // find the remainder of dividing z by 10, this will be the right-hand digit
          c=int(d); // make it an integer, c is the right hand digit
          b=z/10; // divide z by 10 - the whole number value will be the left-hand digit
          e = int(b); // e is the left hand digit
          digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[c]); 
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[e]); 
          digitalWrite(latchpin, HIGH);
        }
        delay(speed);
      }
      delay(2000);
      //  Count down
      for (int z=99; z>=0; z--)
      {
        digitalWrite(latchpin, LOW);
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
        digitalWrite(latchpin, HIGH);
        if (z<10)
        {
          digitalWrite(latchpin, LOW);
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[z]); // sends the digit down the serial path
          shiftOut(datapin, clockpin, LSBFIRST, 255); // sends a blank down the serial path to push the digit to the right
          digitalWrite(latchpin, HIGH);
        }
        else if (z>=10)
        {
          d=z%10; // find the remainder of dividing z by 10, this will be the right-hand digit
          c=int(d); // make it an integer, c is the right hand digit
          b=z/10; // divide z by 10 - the whole number value will be the left-hand digit
          e = int(b); // e is the left hand digit
          digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[c]); 
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[e]); 
          digitalWrite(latchpin, HIGH);
        }
        delay(speed);
      }
    
    
      delay(2000);
    }
    لایک کردن

  2. #2
    Junior Member
    تاریخ عضویت
    Jul 2016
    نوشته ها
    15
    نقل قول نوشته اصلی توسط magmagmary نمایش پست ها
    فکر می کنم شما هدر کد رو مطالعه نکردید!
    کد:
    int latchpin = 5; 
    int clockpin = 7;
    int datapin = 6;
    float b = 0;
    int c = 0;
    float d = 0;
    int e = 0;
    int speed = 300; // used to control speed of counting
    int segdisp[10] = {3,159,37,13,153,73,65,27,1,9 };
    int digits[]= {128,64,32,16,8,4,2,1};
    void setup()
    {
      pinMode(latchpin, OUTPUT);
      pinMode(clockpin, OUTPUT);
      pinMode(datapin, OUTPUT);
      digitalWrite(latchpin, LOW);
      shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
      shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
      digitalWrite(latchpin, HIGH);
    
    
    }
    void loop()
    {
      setDigit(3,1);
    //  setDigit(1,5);
    //  setDigit(2,0);
      delay(10);
    }
    void setDigit(int dig, int character)
    {
    				   
    	digitalWrite(latchpin, LOW);
            shiftOut(datapin, clockpin, LSBFIRST, segdisp[character]);
            shiftOut(datapin, clockpin, LSBFIRST, digits[dig]);
    	digitalWrite(latchpin, HIGH);
            digitalWrite(latchpin, LOW);
            shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
            shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
            digitalWrite(latchpin, HIGH);
    }
    void shoop()
    {
      //  Count up
      for (int z=0; z<100; z++)
      {
        digitalWrite(latchpin, LOW);
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
        digitalWrite(latchpin, HIGH);
        if (z<10)
        {
          digitalWrite(latchpin, LOW);
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[z]); // sends the digit down the serial path
          shiftOut(datapin, clockpin, LSBFIRST, 255); // sends a blank down the serial path to push the digit to the right
          digitalWrite(latchpin, HIGH);
        }
        else if (z>=10)
        {
          d=z%10; // find the remainder of dividing z by 10, this will be the right-hand digit
          c=int(d); // make it an integer, c is the right hand digit
          b=z/10; // divide z by 10 - the whole number value will be the left-hand digit
          e = int(b); // e is the left hand digit
          digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[c]); 
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[e]); 
          digitalWrite(latchpin, HIGH);
        }
        delay(speed);
      }
      delay(2000);
      //  Count down
      for (int z=99; z>=0; z--)
      {
        digitalWrite(latchpin, LOW);
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the right display
        shiftOut(datapin, clockpin, LSBFIRST, 0); // clears the left display
        digitalWrite(latchpin, HIGH);
        if (z<10)
        {
          digitalWrite(latchpin, LOW);
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[z]); // sends the digit down the serial path
          shiftOut(datapin, clockpin, LSBFIRST, 255); // sends a blank down the serial path to push the digit to the right
          digitalWrite(latchpin, HIGH);
        }
        else if (z>=10)
        {
          d=z%10; // find the remainder of dividing z by 10, this will be the right-hand digit
          c=int(d); // make it an integer, c is the right hand digit
          b=z/10; // divide z by 10 - the whole number value will be the left-hand digit
          e = int(b); // e is the left hand digit
          digitalWrite(latchpin, LOW); // send the digits down to the shift registers!
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[c]); 
          shiftOut(datapin, clockpin, LSBFIRST, segdisp[e]); 
          digitalWrite(latchpin, HIGH);
        }
        delay(speed);
      }
    
    
      delay(2000);
    }



    چرا خوندم ولی تو هدر چیزی به اسامی زیر وجود نداره که
    SCLK_pin

    RCLK_pin

    DIO_pin

  3. #3
    Junior Member
    تاریخ عضویت
    Jul 2016
    نوشته ها
    15
    ببخشید از رو این کده سوال دارم

    #include <dht.h>
    #include "TM1637.h"

    //{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
    //0~9,A,b,C,d,E,F



    #define dht_pin 2 // Pin sensor is connected to
    #define CLK 3//Pins for TM1637
    #define DIO 4

    TM1637 tm1637(CLK,DIO);
    dht DHT;


    void setup(){

    tm1637.init();
    tm1637.set(BRIGHT_TYPICAL);
    //BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;

    delay(1500);//Delay to let system boot


    }//end "setup()"



    void loop(){

    //Start of Program

    DHT.read11(dht_pin);


    int temp = DHT.temperature;
    int humidity = DHT.humidity;

    int digitoneT = temp / 10;
    int digittwoT = temp % 10;

    int digitoneH = humidity / 10;
    int digittwoH = humidity % 10;


    tm1637.display(1,digitoneT);
    tm1637.display(2,digittwoT);
    tm1637.display(3,12); // put a C at the end

    delay (3000);

    tm1637.display(1,23);
    tm1637.display(2,digitoneH);
    tm1637.display(3,digittwoH);


    //Wait 3 seconds before accessing sensor again.

    //Fastest should be once every two seconds.
    delay(3000);

    }// end loop()

  4. #4
    Senior Member
    تاریخ عضویت
    Nov 2015
    نوشته ها
    229
    نقل قول نوشته اصلی توسط مهیار نمایش پست ها
    چرا خوندم ولی تو هدر چیزی به اسامی زیر وجود نداره که
    SCLK_pin

    RCLK_pin

    DIO_pin
    SCLK :Clock
    DIO:data
    RCLK:latch
    لایک کردن

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •  

SEO by vBSEO