Fórum témák

» Több friss téma
Fórum » Arduino
A klónok CH340 Soros-USB illesztőjének drivere (Letöltés)
Lapozás: OK   406 / 853
(#) csatti2 válasza csatti2 hozzászólására (») Dec 11, 2017 /
 
Persze, hogy elrontottam. Megzavart egy kolléga...
A hozzászólás módosítva: Dec 11, 2017
(#) RoliNyh válasza csatti2 hozzászólására (») Dec 11, 2017 /
 
Igazából én nem a rajzra volnék kíváncsi (azzal én is elboldogulok), hanem inkább a szoftverre...
(#) benjami válasza RoliNyh hozzászólására (») Dec 11, 2017 / 1
 
És attól, hogy az 5x256 = 1280bájtnyi karakterkészletet külső memóriába rakod el fogsz férni a 4k-ban? Amit nyersz rajta, elveszted a bonyolultabb programban, a sebességről nem is beszélve. Nem értem miért ragaszkodsz a tiny-hez, amikor világosan látszik, hogy nem grafikus LCD vezérlésre készült.
(#) RoliNyh válasza benjami hozzászólására (») Dec 11, 2017 /
 
Annyira nem ragaszkodnék én, de még nem találtam 1.27mm lábkiosztású SMD tokozásu procit amiben van több hely, és nincs több lába mondjuk 16 nál.
De ha nem is lesz, kénytelen leszek valamelyík nano/mikro vagy valami ilyesminél maradni...
(#) benjami válasza RoliNyh hozzászólására (») Dec 11, 2017 /
 
a 32lábú 0,8mm lábsűrűségű tok már nem felel meg, de egy rakat külső alkatrész meg elfér (annyi helyen már a dip28-as is elférne)? Szerintem a nano-val jársz a legjobban.
(#) RoliNyh válasza benjami hozzászólására (») Dec 11, 2017 /
 
A 0.8mm tokot nem szívesen vállalnám be...
(#) MATA hozzászólása Dec 11, 2017 /
 
Üdv Mesterek!
Itt van ez a kód! Min kellene változtatni hogy nimh cellákat lehessen vele tesztelni lítium cellák helyett? Köszönöm!
  1. ////////////////////////////////////////////////////////////////
  2. // Tester capacitate acumulatori li-ion by TrAx & Nicu 09.2016
  3. // Modificat pentru 4 acumulatori li-ion + referinta stabila TL431 4,5v  
  4. //   PCD8544 library
  5. // Feb 8, 2011  - B. Hobbs
  6. ///////////////////////////////////////////////////////////////
  7.  
  8. #include         // library of functions for Nokia LCD (http://code.google.com/p/pcd8544/)
  9.  
  10. #define LCD_TEXT_WIDTH      14   // Width of text line for Nokia LCD
  11. #define LCD_LINE1            0
  12. #define LCD_LINE2            1
  13. #define LCD_LINE3            2
  14. #define LCD_LINE4            3
  15. #define LCD_LINE5            4
  16. #define LCD_LINE6            5
  17. #define NUM_LINES_ON_LCD     6
  18. #define MAX_BATTERIES        4
  19. #define LOAD_RESISTANCE      5.8    //load resistance in ohms
  20. #define START_BEEP        5000      // frequency in Hz
  21. #define DONE_BEEP         1800
  22. #define SPKR_PIN             8     // The pin used for the SPEAKER
  23. #define LED_PIN             13     // The pin used for the LED
  24. #define LCD_WIDTH           84     // The dimensions of the Nokia LCD(in pixels)...
  25. #define LCD_HEIGHT          48
  26. #define BAT_WIDTH           18     // Width of battery icon in pixels
  27. #define BAT_HEIGHT           1     // Height of battery Icon (1 line = 8 pixels)
  28. #define BATTERY_ICON_HORIZ  34     // Horizontal position of battery icon (in pixels)
  29. #define MAH_HORIZ_POSITION  60     // Horizontal position of mAh display
  30.  
  31. // Bitmaps for battery icons, Full, Empty, and Battery with an X (no battery)
  32. static const byte batteryEmptyIcon[] ={ 0x1c, 0x14, 0x77,0x41,0x41,0x41,
  33.            0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x7f};
  34. static const byte batteryFullIcon[] = { 0x1c, 0x14, 0x77,0x7f,0x7f,0x7f,
  35.            0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f};
  36. static const byte noBatteryIcon [] = { 0x1C, 0x14, 0x77, 0x41, 0x41,0x41,
  37.            0x41,0x63,0x77,0x5D,0x5D,0x77,0x63,0x41,0x41,0x41,0x41,0x7f};
  38. ///////// Battery voltage limits //////////////////////////////////////////
  39. //  The following constants define the expected voltages for detecting the
  40. //  battery and the minimum voltage at which the discharge test is complete.
  41. // *Lithium Ion cells have a fully charged no-load voltage of 3.6 to 3.7 volts
  42. //    and cause too much power dissapation in the load resistor, so
  43. //    they will not be tested
  44. // *NiCads have a fully charged no-load voltage of 1.2 to 1.35 volts
  45. // *NiMH batteries have a fully charged no-load voltage of 1.4 to 1.45 volts
  46. //    Since the NiCad and NiMH batteries are similar (and difficult to
  47. //    reliably autodetect) they are handled identically in this program.
  48. ////////////////////////////////////////////////////////////////////////////
  49. #define MAX_VOLTAGE           4290  // Max Voltage used for detection (in mV)
  50. #define MIN_VOLTAGE      2500   //  Min Voltage for load removal (in mV)
  51.  
  52. static PCD8544 lcd;
  53. enum {NOT_INSTALLED, DETECTING_TYPE, OVER_VOLTAGE, TEST_IN_PROGRESS, DONE};  // battery status values
  54.  
  55. struct batteryStruct
  56. {
  57.     unsigned long  charge;         // Total microamp hours for this battery
  58.     byte battStatus;               // set this to DONE when this cell's test is complete
  59.     byte batteryVoltagePin;        // Analog sensor pin (0-5) for reading battery voltage
  60.     byte fetVoltagePin;            // Analog sensor pin (0-5) to read voltage across FET
  61.     byte dischargeControlPin;      // Output Pin that controlls the load for this battery
  62.     unsigned int lowerThreshold;   // voltage at which discharge is complete (mV)
  63.     unsigned long PrevTime;        // Previous time reading (in milliseconds)
  64.     unsigned int numSamplesAboveMin; // number of good voltage readings (to determine battery installed)
  65.     unsigned int numSamplesBelowMin; // number of samples read below minimum (to determine battery discharged)  
  66. }
  67. battery[MAX_BATTERIES];
  68.  
  69.  
  70.  
  71.  
  72. static const byte progressIndicator[] = "-\0|/";
  73. static const byte backslashNokia[] =    //define backslach LCD character for Nokia5110 (PCD8544)
  74. {
  75.    B0000010,
  76.    B0000100,
  77.    B0001000,
  78.    B0010000,
  79.    B0100000
  80. };
  81.  
  82. //Prototypes for utility functions
  83. void printRightJustifiedUint(unsigned int n, unsigned short numDigits);
  84. void ClearDisplayLine(int line);   // function to clear specified line of LCD display
  85. unsigned int getBatteryVoltage(unsigned int batteryNum);
  86. unsigned int getFetVoltage(unsigned int batteryNum);
  87. void printVoltage(unsigned int n);
  88. //-------------------------------------------
  89.  
  90. float referinta = 4500.;  // in mV
  91.  
  92. void setup()
  93. {
  94.    analogReference(EXTERNAL); // use AREF for reference voltage
  95.  
  96.    unsigned int batteryNum;
  97.    unsigned int battVoltage;
  98.  
  99.    Serial.begin(9600);             // Initialize serial port
  100.    pinMode(SPKR_PIN, OUTPUT);      //Set output mode for pin used for spkr
  101.    
  102.    lcd.begin(LCD_WIDTH, LCD_HEIGHT);// set up the LCD's dimensions in pixels
  103.    // Register the backslash character as a special character
  104.    // since the standard library doesn't have one
  105.    lcd.createChar(0, backslashNokia);
  106.    tone(SPKR_PIN, START_BEEP,50);   // short beep
  107.    
  108.    battery[0].dischargeControlPin = 12;    // setup the corresponding pins
  109.    battery[0].fetVoltagePin = 0;           // for each battery according to
  110.    battery[0].batteryVoltagePin = 1;       // schematic wiring diagram.
  111.    
  112.    battery[1].dischargeControlPin = 11;      
  113.    battery[1].fetVoltagePin = 2;
  114.    battery[1].batteryVoltagePin = 3;
  115.  
  116.    battery[2].dischargeControlPin = 10;
  117.    battery[2].fetVoltagePin = 4;
  118.    battery[2].batteryVoltagePin = 5;
  119.  
  120.    battery[3].dischargeControlPin = 9;
  121.    battery[3].fetVoltagePin = 6;
  122.    battery[3].batteryVoltagePin = 7;
  123.  
  124.    battery[0].battStatus = DETECTING_TYPE;  // initialize status of each battery
  125.    battery[1].battStatus = DETECTING_TYPE;
  126.    battery[2].battStatus = DETECTING_TYPE;
  127.    battery[3].battStatus = DETECTING_TYPE;
  128.  
  129.    battery[0].numSamplesAboveMin = 0;
  130.    battery[1].numSamplesAboveMin = 0;
  131.    battery[2].numSamplesAboveMin = 0;
  132.    battery[3].numSamplesAboveMin = 0;
  133.  
  134.    battery[0].numSamplesBelowMin = 0;
  135.    battery[1].numSamplesBelowMin = 0;
  136.    battery[2].numSamplesBelowMin = 0;
  137.    battery[3].numSamplesBelowMin = 0;
  138.  
  139.    // Set the three FET control pins for output
  140.    pinMode(battery[0].dischargeControlPin, OUTPUT);
  141.    pinMode(battery[1].dischargeControlPin, OUTPUT);
  142.    pinMode(battery[2].dischargeControlPin, OUTPUT);
  143.    pinMode(battery[3].dischargeControlPin, OUTPUT);
  144.    
  145.    lcd.setCursor(0, LCD_LINE1);// First Character, First line
  146.    lcd.print("     Test   ");  // Print a message to the LCD.
  147.    lcd.setCursor(0, LCD_LINE2);
  148.    lcd.print("  Capacitate  ");
  149.    lcd.setCursor(0, LCD_LINE3);  
  150.    lcd.print("    Li-Ion    ");
  151.    lcd.setCursor(0, LCD_LINE4);
  152.    lcd.print("   Creat de  ");
  153.    lcd.setCursor(0, LCD_LINE5);  
  154.    lcd.print(" TrAx Palicaru");  
  155.  
  156.    delay(3000);
  157.  
  158.    lcd.clear();        // clear the display
  159.    lcd.print("  Descarcare");
  160.    lcd.setCursor(0, LCD_LINE2);//  set cursor to 3rd line
  161.    lcd.print(" Volti     mAh");  
  162.    
  163. }
  164.  
  165. void loop()
  166. {
  167.    static unsigned int i = 0 ;
  168.    static unsigned int  line , p, batteryNum, width1;
  169.    static unsigned long duration, currentTime;
  170.    static unsigned int battVoltage,fetVoltage, loadCurrent;
  171.    static boolean done = false;
  172.    static unsigned int beepCounter = 0;
  173.  
  174.    if (!done)
  175.    {
  176.       lcd.setCursor(LCD_WIDTH-5, LCD_LINE1);  // end of line 1
  177.       lcd.write(progressIndicator[i  % (sizeof(progressIndicator)-1)]);
  178.       lcd.home();
  179.       lcd.write(progressIndicator[i++ % (sizeof(progressIndicator)-1)]);
  180.      
  181.       for (batteryNum= 0 ; batteryNum < MAX_BATTERIES ; batteryNum++)
  182.       {
  183.          battVoltage = getBatteryVoltage(batteryNum);
  184.          fetVoltage = getFetVoltage(batteryNum);
  185.          // Calculate the display line number for this battery
  186.          line = batteryNum + LCD_LINE3;  // first battery displayed on line4
  187.            
  188.          if ( battery[batteryNum].battStatus == TEST_IN_PROGRESS)
  189.          {
  190.             ClearDisplayLine(line);
  191.             printVoltage(battVoltage);
  192.             lcd.setCursor(BATTERY_ICON_HORIZ , line);   // indent to horiz pixel location for battery icon    
  193.             width1 =  3 + (i % (sizeof(batteryEmptyIcon)-3)) ; //start at offset of 3 pixels
  194.  
  195.             // Display the left half of the Battery Icon (Empty), at calculated width
  196.             lcd.drawBitmap(batteryEmptyIcon, width1, 1); // Battery Empty icon (partial) one line tall
  197.             // Display the remainder of the Battery Icon (Full)
  198.             lcd.drawBitmap(&batteryFullIcon[width1], sizeof(batteryFullIcon) - width1, 1);
  199.  
  200.             // Calculate the time duration between the last reading (in milliseconds)
  201.             currentTime = millis();
  202.             duration = (currentTime - battery[batteryNum].PrevTime);
  203.             battery[batteryNum].PrevTime = currentTime;
  204.             // Current through resistor is voltage across the resistor divided by load restistance
  205.             // Since the voltage is in millivolts, the current will be in milliamps
  206.             loadCurrent = (battVoltage - fetVoltage) / LOAD_RESISTANCE;
  207.             // milliAmpHours = current (in milliAmps)  * duration (in Hours)
  208.             // Must divide by (60*60*1000) to convert duration in micro seconds to hours
  209.             // But doing this now would cause a loss of precision, so
  210.             // divide by 3600 which will result in microamp hours to be summed.
  211.             // Divide by 1000 when milliamp hours are desired for display
  212.             battery[batteryNum].charge +=   (loadCurrent * duration) / 3600;
  213.             Serial.print("Bat");
  214.             Serial.print(batteryNum+1);
  215.             Serial.print("  V=");
  216.             Serial.print(battVoltage);
  217.             Serial.print("   duration ");
  218.             Serial.print(duration);
  219.             Serial.print("ms   load=");
  220.             Serial.print(loadCurrent );
  221.             Serial.print("mA     mAh=");
  222.             Serial.println(battery[batteryNum].charge/1000);
  223.    
  224.             lcd.setCursor(MAH_HORIZ_POSITION, line);  // indent to pixel location for mAh
  225.             printRightJustifiedUint(battery[batteryNum].charge/1000,4);
  226.             // Has the battery voltage dropped below the minimum?
  227.             // Must have several battery voltage samples below minimum
  228.             // in a row, before declaring 'done'
  229.             if (battVoltage <  battery[batteryNum].lowerThreshold)
  230.             {
  231.                Serial.print("Batt");
  232.                Serial.print(batteryNum);
  233.                Serial.print(" Below threshold: ");
  234.                Serial.println(battVoltage);
  235.                if ( battery[batteryNum].numSamplesBelowMin < 3 )
  236.                {
  237.                   battery[batteryNum].numSamplesBelowMin++;
  238.                }
  239.                else
  240.                {
  241.                   // This testing on this battery is complete, set status to DONE
  242.                   // Turn off the discharge load and update the display
  243.                   battery[batteryNum].battStatus = DONE;
  244.                   digitalWrite(battery[batteryNum].dischargeControlPin, LOW); // turn off the load
  245.                   ClearDisplayLine(line);
  246.                   // Display the Empty Battery Icon
  247.                   lcd.setCursor(BATTERY_ICON_HORIZ , line);   // indent to horiz pixel location for battery icon    
  248.                   lcd.drawBitmap(batteryEmptyIcon, sizeof(batteryEmptyIcon), 1);
  249.                   lcd.setCursor(MAH_HORIZ_POSITION, line);  // indent to pixel location for mAh
  250.                   printRightJustifiedUint(battery[batteryNum].charge/1000,4);
  251.                   tone(SPKR_PIN, DONE_BEEP,50); // short beep
  252.                   // Check to see if ALL installed batteries are in the DONE state.
  253.                   done = checkAllDone();
  254.                }
  255.             }
  256.             else
  257.             {
  258.               // reset counter since this reading was good.
  259.              battery[batteryNum].numSamplesBelowMin = 0;
  260.             }
  261.          }
  262.          else if (battery[batteryNum].battStatus == DONE)
  263.          {
  264.             // don't update this line of the display    
  265.          }
  266.          else if (battery[batteryNum].battStatus == NOT_INSTALLED)
  267.          {
  268.            ClearDisplayLine(line);
  269.            lcd.setCursor(BATTERY_ICON_HORIZ , line);   // indent to horiz pixel location for battery icon    
  270.            lcd.drawBitmap(noBatteryIcon, sizeof(noBatteryIcon), 1);
  271.            if (battVoltage >= MIN_VOLTAGE)
  272.            {
  273.               // This condition indicates that a battery has
  274.               // been installed, change status to Detecting
  275.               battery[batteryNum].battStatus = DETECTING_TYPE;
  276.            }  
  277.          }  
  278.          else if (battery[batteryNum].battStatus == OVER_VOLTAGE )
  279.          {
  280.            lcd.setCursor(0, line);
  281.            lcd.print(" OVER VOLTAGE ");
  282.            battery[batteryNum].battStatus =  DETECTING_TYPE;
  283.          }
  284.          else if (battery[batteryNum].battStatus == DETECTING_TYPE)
  285.          {
  286.            lcd.setCursor(0, line);
  287.            lcd.print(" Detecting... ");
  288.            detectBatteryType(batteryNum, battVoltage );
  289.          }
  290.          else // undefined battery status
  291.          {
  292.             // should never get here
  293.             lcd.setCursor(0, line);
  294.             lcd.print("???");
  295.          }  
  296.       }
  297.    }
  298.    else
  299.    {
  300.       // we're done - all batteries are discharged
  301.       if (beepCounter  < 3 )
  302.       {
  303.          lcd.setCursor(0, LCD_LINE1);// First Character, First line
  304.          lcd.print(" Test Complet ");
  305.          lcd.setInverse(beepCounter % 2); // Invert the display
  306.          tone(SPKR_PIN, DONE_BEEP,200);  // done beep
  307.          beepCounter++;
  308.       }
  309.       // continue to update battery voltage
  310.       for (batteryNum= 0 ; batteryNum < MAX_BATTERIES ; batteryNum++)
  311.       {
  312.          battVoltage = getBatteryVoltage(batteryNum);
  313.          line = batteryNum + LCD_LINE3;  // first battery displayed on line4
  314.          if (battery[batteryNum].battStatus == DONE)
  315.          {
  316.            // set cursor at beginning of line but don't erase battery icon
  317.            // or the result mAh
  318.            lcd.setCursor(0 , line);
  319.            printVoltage(battVoltage);
  320.          }
  321.          else
  322.          {
  323.            ClearDisplayLine(line);
  324.            lcd.setCursor(BATTERY_ICON_HORIZ , line);   // indent to horiz pixel location for battery icon    
  325.            lcd.drawBitmap(noBatteryIcon, sizeof(noBatteryIcon), 1);
  326.          }
  327.       }
  328.      
  329.    }
  330.     delay(1000);  // wait one second, then get next set of samples
  331. } //end of main loop
  332.  
  333.  
  334. //////////////////////////////////////////////////////////////////////////////////
  335. // detectBatteryType()  Detects the battery type and sets up the appropriate
  336. //               status and thresholds
  337. //////////////////////////////////////////////////////////////////////////////////
  338. void detectBatteryType(unsigned int batteryNum, unsigned int battVoltage)
  339. {
  340.    if (battery[batteryNum].numSamplesAboveMin > 3)
  341.    {
  342.       if (battVoltage > MAX_VOLTAGE )
  343.       {
  344.          battery[batteryNum].battStatus = OVER_VOLTAGE;
  345.       }
  346.       else if (battVoltage > MIN_VOLTAGE)
  347.       {
  348.          // Battery Type identified as: li-ion
  349.          // Initialize variables and start discharge
  350.          battery[batteryNum].lowerThreshold = MIN_VOLTAGE;
  351.          battery[batteryNum].battStatus = TEST_IN_PROGRESS;
  352.          battery[batteryNum].charge = 0;
  353.          battery[batteryNum].PrevTime = millis();
  354.          digitalWrite(battery[batteryNum].dischargeControlPin, HIGH); // turn on the FET
  355.       }
  356.       else
  357.       {
  358.          battery[batteryNum].numSamplesAboveMin = 0;
  359.       }            
  360.    }
  361.    else // not enough good samples yet
  362.    {
  363.       if (battVoltage > MIN_VOLTAGE)
  364.       {
  365.          battery[batteryNum].numSamplesAboveMin++;
  366.          battery[batteryNum].numSamplesBelowMin = 0;
  367.       }
  368.       else
  369.       {
  370.          battery[batteryNum].numSamplesBelowMin++;
  371.          battery[batteryNum].numSamplesAboveMin = 0;
  372.       }
  373.    }
  374.    if (battery[batteryNum].numSamplesBelowMin > 3)
  375.    {
  376.       battery[batteryNum].battStatus = NOT_INSTALLED;
  377.    }      
  378. }
  379.  
  380.  
  381. //////////////////////////////////////////////////////////////////////////////////
  382. // checkAllDone()  checks to see if ALL installed batteries are in the DONE state.
  383. //                 return true if all tests are complete.
  384. //////////////////////////////////////////////////////////////////////////////////
  385. boolean checkAllDone()
  386. {
  387.   unsigned int batteryNum;
  388.   unsigned int count=0;
  389.  
  390.    for (batteryNum= 0 ; batteryNum < MAX_BATTERIES ; batteryNum++)
  391.    {
  392.      if( battery[batteryNum].battStatus == TEST_IN_PROGRESS)
  393.         return false;
  394.    }
  395.    return true;
  396. }      
  397.      
  398. //////////////////////////////////////////////////////////////////////////////////
  399. // printRightJustifiedUint() prints unsigned integer, right justified
  400. //            on the LCD with the specified number of digits (up to 5)
  401. //            supressing leading zeros. Prints asterisks if the number is too
  402. //            big to be displayed.
  403. //////////////////////////////////////////////////////////////////////////////////
  404. void printRightJustifiedUint(unsigned int n, unsigned short numDigits)
  405. {
  406.  
  407.   const unsigned int powersOfTen[]={1,10,100,1000,10000};
  408.   boolean overflow = false, supressZero = true;
  409.   unsigned int digit, d;
  410.  
  411.   for (d = numDigits ; d > 0 ; d--)
  412.   {
  413.      if (overflow || numDigits > 5)
  414.      {
  415.        lcd.print("*");
  416.      }
  417.      else
  418.      {
  419.        // pow() function doesn't work as expected - use array powersOfTen[]
  420.        digit = n / powersOfTen[d-1];
  421.        n = n % (powersOfTen[d-1]);
  422.        if (digit == 0 && supressZero && d > 1)
  423.           lcd.print(" ");
  424.        else if (digit <= 9)
  425.        {
  426.           lcd.print(digit);
  427.           supressZero = false;
  428.        }
  429.        else
  430.        {
  431.          overflow = true;
  432.          lcd.print("*");
  433.        }
  434.      }
  435.   }          
  436. }
  437.  
  438. //////////////////////////////////////////////////////////////////////////////////
  439. // printVoltage() prints unsigned integer (millivolts), as a voltage with
  440. //        decimal point on the LCD from 0.000 to 9.999 volts
  441. //        Prints asterisks if the number is too big to be displayed.
  442. //////////////////////////////////////////////////////////////////////////////////
  443. void printVoltage(unsigned int n)
  444. {
  445.  
  446.   const unsigned int powersOfTen[]={1,10,100,1000,10000},  numDigits = 4;
  447.   boolean overflow = false, supressZero = true;
  448.   unsigned int digit, d;
  449.  
  450.   for (d = numDigits ; d > 0 ; d--)
  451.   {
  452.      if (overflow)
  453.      {
  454.        lcd.print("*");
  455.      }
  456.      else
  457.      {
  458.        // pow() function doesn't work as expected - use array powersOfTen[]
  459.        digit = n / powersOfTen[d-1];
  460.        n = n % (powersOfTen[d-1]);
  461.        if (digit <= 9)
  462.        {
  463.           lcd.print(digit);
  464.           if (d == numDigits)
  465.              lcd.print(".");
  466.        }
  467.        else
  468.        {
  469.          overflow = true;
  470.          lcd.print("*");
  471.        }
  472.      }
  473.   }          
  474. }
  475.  
  476.  
  477. //////////////////////////////////////////////////////////////////////////////////
  478. // ClearDisplayLine()  utility function to clear one full line of the display
  479. //////////////////////////////////////////////////////////////////////////////////
  480. void ClearDisplayLine(int line)
  481. {
  482.   unsigned int i;
  483.   lcd.setCursor(0, line);  // put cursor on first char of specified line
  484.   lcd.clearLine();
  485.   lcd.home();
  486. }
  487.  
  488. //////////////////////////////////////////////////////////////////////////////////
  489. // Read analog input for specified battery and maps into a voltage (in millivolts)
  490. //////////////////////////////////////////////////////////////////////////////////
  491. unsigned int getBatteryVoltage(unsigned int batteryNum)
  492. {
  493.    //return analogRead(battery[batteryNum].batteryVoltagePin), *4.887;
  494.    return map(analogRead(battery[batteryNum].batteryVoltagePin), 0,1023,0,referinta);
  495. }
  496.  
  497. //////////////////////////////////////////////////////////////////////////////////
  498. // Read analog input for specified battery's FET and maps into a voltage (in millivolts)
  499. //////////////////////////////////////////////////////////////////////////////////
  500. unsigned int getFetVoltage(unsigned int batteryNum)
  501. {
  502.   //return analogRead(battery[batteryNum].fetVoltagePin)*4.887;
  503.    return map(analogRead(battery[batteryNum].fetVoltagePin), 0,1023,0,referinta);
  504. }
A hozzászólás módosítva: Dec 11, 2017
(#) csatti2 válasza RoliNyh hozzászólására (») Dec 11, 2017 /
 
A 0,8mm nem vészes, én mostanában 0,5-ösöket használok leginkább. Meg kell próbálni, menni fog.
(#) berkesandor hozzászólása Dec 15, 2017 /
 
Arduino Minivel használok két I2C eszközt. Ha kommunikációba zavar keletkezik, megáll a rendszerem, és nem alszik vissza az arduino.
Meg lehet valahogy oldani, hogy ilyen esetekben újra próbálkozzon a vezérlő (pl. 10 másodperc "fagyás" után) ?
(#) berkesandor válasza berkesandor hozzászólására (») Dec 15, 2017 /
 
Annyival egészíteném ki, hogy az arduino reset-elése nekem nem jó megoldás.
(#) atus1981 válasza berkesandor hozzászólására (») Dec 15, 2017 /
 
Lefagyott procin csak a reset tud segíteni.
(#) berkesandor válasza atus1981 hozzászólására (») Dec 15, 2017 /
 
Nem fagy le, csak a kommunikációra vár.
(#) nedudgi válasza berkesandor hozzászólására (») Dec 15, 2017 /
 
Az I2C-ben le van kezelve, amikor a slave feltartja forgalmat?
(#) berkesandor válasza nedudgi hozzászólására (») Dec 15, 2017 /
 
LCD és RTC megy róla, használom mind a kettő saját könyvtárát, azon kívül nem csináltam semmit, ezek szerint nincs.
(#) krauszkrisztian hozzászólása Dec 15, 2017 /
 
Üdv!
Van egy Arduino UNO-m. Építettem vele egy kocsit, és működött.
Rátettem egy 9v-os elemet, és nem indította el a programot. Megpróbáltam az alapra újra feltölteni a programot, de nem ment. Ezt megpróbáltam a Blink nevű programmal is, de azzal is ugyanazt írta ki.
Ezen kívül feltöltés közben az Rx pin 10 másodpercenként villan egyet..
Mi lehet a baja? Lehet, hogy nem szabadott volna rátenni oda neki 9v-ot, és tönkretette az AVR-t?
Ezt írja ki a kocsi kódjánál:
Idézet:
„avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x56
Probléma az alaplapra feltöltéskor. Nézd meg a http://www.arduino.cc/en/Guide/Troubleshooting#upload -t javaslatokért.”

A Blinknél:
Idézet:
„avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3a
Probléma az alaplapra feltöltéskor. Nézd meg a http://www.arduino.cc/en/Guide/Troubleshooting#upload -t javaslatokért.

előre is köszönöm!
(#) csatti2 válasza krauszkrisztian hozzászólására (») Dec 15, 2017 / 1
 
Egész pontosan mely lábakra kötötted a 9V-ot? Mondjuk gyanítom, hogy tönkretetted.
(#) RoliNyh válasza krauszkrisztian hozzászólására (») Dec 15, 2017 / 1
 
Ha az 5 V-os táp bemenetre adtál 9V-ot, akkor lehet, hogy az kinyírta...
(#) krauszkrisztian válasza csatti2 hozzászólására (») Dec 15, 2017 /
 
A Vin lábra a +t, a Gndre a -t
(#) Elektro.on válasza MATA hozzászólására (») Dec 15, 2017 / 1
 
Szia!
Én inkább PIC -et használok, de ha elolvasod a kommentet akkor abból az derül ki, hogy a MIN_VOLTAGE és a MAX_VOLTAGE konstansokat kell a komment szerinti értékre állítani. (mV -ban)
(#) frob hozzászólása Dec 15, 2017 /
 
Sziasztok

nrf51822 bletooth modult szeretnék programozni arduinoval, elvileg lehet, de nem találok hozzá példa programokat.
Valaki esetlegesen használta már, tudna segíteni?
Automata kapcsolódás, alacsony fogyasztás beállítás és i2C kommunikáció ami érdekelne.
Előre is köszi!
R.
(#) csatti2 válasza krauszkrisztian hozzászólására (») Dec 15, 2017 / 1
 
Hmm, azt bírnia kellett volna. Ellenőrizted a tápfeszültségeket?
(#) krauszkrisztian válasza csatti2 hozzászólására (») Dec 15, 2017 /
 
Azaz?
(#) vargaf válasza krauszkrisztian hozzászólására (») Dec 15, 2017 / 1
 
Azaz a +5 V meglétét.
(#) krauszkrisztian válasza vargaf hozzászólására (») Dec 15, 2017 /
 
Megvan
(#) MATA válasza Elektro.on hozzászólására (») Dec 15, 2017 /
 
Oké köszönöm szépen azt fogom tenni!
(#) gyerek67 hozzászólása Dec 17, 2017 /
 
Szervusztok, segítséget kérnék!
A fiam vásárolt kéz alatt egy használt Arduino Nano-t.
Az eszköz jelenleg nem kommunikál USB-n a legfrissebb gyári programozó szoftverrel.
A CH340 driver jó, mert simán beszélgetek rajta keresztül egy ESP-8266 Wemos D1-el.
Az eladó elmondása szerint eddig valamilyen más módon, Linux alatt használták.
A kis jószág vélhetően jó, mert a LED BLINK program, amit legutóbb beletöltöttek, remekül működik, miután tápot kap.
Mit kellene tennem? Valahogyan másik bootloadert tölteni bele, hogy USB-n keresztül elérjem?
Sajnos Arduinoban semmilyen tapasztatom nincsen, most találkoztam vele először.
Az USB csatit átmértem, a lábak rámennek a CH340-re.
(#) morgo válasza gyerek67 hozzászólására (») Dec 17, 2017 /
 
Szia!
Ha a "gyári programozó szoftver" alatt az Arduino IDE-t érted, ebben be kell állítani a lap típusát és a soros port számát. Csak ezután tudsz írni rá. Ezeknek feltétele, hogy az eszközkezelőben megjelenjen egy új soros port amikor csatlakoztatod a nanot.
(#) StMiklos válasza gyerek67 hozzászólására (») Dec 17, 2017 /
 
Szevasz!

Nekem elsőre rögtön, minden faxni nélkül ment (Win7), WIN újratelepítés után az Istennek se, drivert kellett hozzá letöltenem, na azzal már gond nélkül megy ismét.

Üdv: StMiklos
(#) Kari55 hozzászólása Dec 18, 2017 /
 
Sziasztok.

Hogyan tudnám megállapítani, hogy mi ment tönkre az Arduino unomban, mert semmit nem reagál ha összedugom a számítógéppel USB-n, de külső tápról sem működik, és nincs az eszközkezelőben sem.

Csak az ON LED, és az L jelzésü LED világít folyamatosan.

Köszönöm előre is.
(#) csatti2 válasza Kari55 hozzászólására (») Dec 18, 2017 /
 
Rendes AVR programozóval lehet ellenőrizni, hogy működik-e még a mikrokontroller. Milyen UNO-d van egyébként (SMD-s?, ATMEGA16U2 vagy CH340 az USB-serial átalakító?).
Következő: »»   406 / 853
Bejelentkezés

Belépés

Hirdetés
XDT.hu
Az oldalon sütiket használunk a helyes működéshez. Bővebb információt az adatvédelmi szabályzatban olvashatsz. Megértettem