Skocz do zawartości

Przeszukaj forum

Pokazywanie wyników dla tagów 'arduino nano'.

  • Szukaj wg tagów

    Wpisz tagi, oddzielając przecinkami.
  • Szukaj wg autora

Typ zawartości


Kategorie forum

  • Elektronika i programowanie
    • Elektronika
    • Arduino i ESP
    • Mikrokontrolery
    • Raspberry Pi
    • Inne komputery jednopłytkowe
    • Układy programowalne
    • Programowanie
    • Zasilanie
  • Artykuły, projekty, DIY
    • Artykuły redakcji (blog)
    • Artykuły użytkowników
    • Projekty - DIY
    • Projekty - DIY roboty
    • Projekty - DIY (mini)
    • Projekty - DIY (początkujący)
    • Projekty - DIY w budowie (worklogi)
    • Wiadomości
  • Pozostałe
    • Oprogramowanie CAD
    • Druk 3D
    • Napędy
    • Mechanika
    • Zawody/Konkursy/Wydarzenia
    • Sprzedam/Kupię/Zamienię/Praca
    • Inne
  • Ogólne
    • Ogłoszenia organizacyjne
    • Dyskusje o FORBOT.pl
    • Na luzie

Kategorie

  • Quizy o elektronice
  • Quizy do kursu elektroniki I
  • Quizy do kursu elektroniki II
  • Quizy do kursów Arduino
  • Quizy do kursu STM32L4
  • Quizy do pozostałych kursów

Szukaj wyników w...

Znajdź wyniki, które zawierają...


Data utworzenia

  • Rozpocznij

    Koniec


Ostatnia aktualizacja

  • Rozpocznij

    Koniec


Filtruj po ilości...

Data dołączenia

  • Rozpocznij

    Koniec


Grupa


Imię


Strona

Znaleziono 6 wyników

  1. Witam, W trakcie robienia projektu (pojazd sterowany pilotem przez Bluetooth) napotkałem problem z nowo kupionym Arduino Nano Every (piny lutowałem sam). Chciałem, aby na pinach cyfrowych (podpiętych do przycisków) odczytywane było napięcie (HIGH lub LOW). Arduino z ustawionymi pinami na INPUT odczytuje stan wysoki - zawsze, choć powinien być stan niski. Wszystko działa dobrze po ustawieniu pinów na OUTPUT. Czy tak powinno być? Z tego co wiem to ustawienie na INPUT służy do odczytu, a odczyt z pinu ustawionego na OUTPUT powinien skończyć się błędem. Dla testu napisałem program: const int pinOut = 6; const int pinIn = 7; void setup() { Serial.begin(9600); pinMode(pinOut, OUTPUT); pinMode(pinIn, INPUT); } void loop() { //Odczyt z pinu 6 if(digitalRead(pinOut) == LOW) { Serial.println("Pin 6: LOW"); } //Odczyt z pinu 7 if(digitalRead(pinIn) == LOW) { Serial.println("Pin 7: LOW"); }else { Serial.println("Pin 7: HIGH"); } delay(1000); } Arduino jest podłączone tylko do komputera, żadne piny nie są połączone. A tutaj wynik: Pin 6: LOW Pin 7: HIGH Pin 6: LOW Pin 7: HIGH Pin 6: LOW Pin 7: HIGH Pin 6: LOW Pin 7: HIGH Pin 6: LOW Pin 7: HIGH Pin 6: LOW Pin 7: HIGH Czy to ja się mylę, czy np. płytka jest uszkodzona? Z góry dziękuję za pomoc.
  2. Witam Mam pytanie czy jest jakaś możliwość podłączenia 4 czujników przepływu (water flow sensor yf-s401) do arduino nano nie używając arduino mega ? Sensor ten opiera się na czujniku Halla i do transmisji sygnału wykorzystuje przerwania. Problem w tym że arduino które posiadam mają tylko dwa piny obsługujące te przerwania (pin 2 i 3) . Czy jest może możliwość obsługi tych czujników przez arduino nano i np.funkcję pinchange? jeżeli tak to byłbym wdzięczy za przykład z zainicjowaniem dodatkowych 2 czujników. Kod na którym obecnie się opieram to byte sensorInterrupt_1 = 0; // 0 = digital pin 2 byte sensorPin_1 = 2; float calibrationFactor_1 = 5.5; volatile byte pulseCount_1; byte pulseCount1;//protected transfer float flowRate_1; unsigned int flowMilliLitres_1; unsigned long totalMilliLitres_1; unsigned long totalLitres_1; //For FlowSensor_2 Ble byte sensorInterrupt_2 = 1; // 1 = digital pin 3 byte sensorPin_2 = 3; //float calibrationFactor_2 = 5.44; float calibrationFactor_2 = 6.44; volatile byte pulseCount_2; byte pulseCount2;//protected transfer float flowRate_2; unsigned int flowMilliLitres_2; unsigned long totalMilliLitres_2; unsigned long totalLitres_2; //sensor reading and print timing unsigned long readInterval = 1000; unsigned long lastRead; void setup() { Serial.begin(115200); //Setup_FlowSensor_1 pinMode(sensorPin_1, INPUT); digitalWrite(sensorPin_1, HIGH); pulseCount_1 = 0; flowRate_1 = 0.0; flowMilliLitres_1 = 0; totalMilliLitres_1 = 0; totalLitres_1 = 0; attachInterrupt(sensorInterrupt_1, pulseCounter_1, FALLING); //Setup_FlowSensor_2 pinMode(sensorPin_2, INPUT); digitalWrite(sensorPin_2, HIGH); pulseCount_2 = 0; flowRate_2 = 0.0; flowMilliLitres_2 = 0; totalMilliLitres_2 = 0; totalLitres_2 = 0; attachInterrupt(sensorInterrupt_2, pulseCounter_2, FALLING); } void flowSensors() { if ((millis() - lastRead) > readInterval) // process counters once per second { lastRead += readInterval; noInterrupts(); pulseCount1 = pulseCount_1; pulseCount_1 = 0; pulseCount2 = pulseCount_2; pulseCount_2 = 0; interrupts(); flowRate_1 = (pulseCount1) / calibrationFactor_1; flowRate_2 = (pulseCount2) / calibrationFactor_2; flowMilliLitres_1 = (flowRate_1 / 60) * 1000; totalMilliLitres_1 += flowMilliLitres_1; totalLitres_1 = (totalMilliLitres_1 / 1000); flowMilliLitres_2 = (flowRate_2 / 60) * 1000; totalMilliLitres_2 += flowMilliLitres_2; totalLitres_2 = (totalMilliLitres_2 / 1000); Serial.print("FlowRate_1= "); Serial.print(flowRate_1); Serial.print(" Total_1= "); Serial.println(totalLitres_1); Serial.println(" "); //pulseCount_1 = 0; Serial.print("FlowRate_2= "); Serial.print(flowRate_2); Serial.print(" Total_2= "); Serial.println(totalLitres_2); Serial.println(" "); //pulseCount_2 = 0; } } void pulseCounter_1() { pulseCount_1++; } void pulseCounter_2() { pulseCount_2++; } void loop() { flowSensors(); }
  3. Witam, mam mały problem z sterowaniem serwomechanizmem za pomocą modułów bluetooth HC-05. Wartością wysyłaną jest sygnał z czujnika zginania, jest on zmapowany. Łącząc to na jednym arduino wszystko śmiga jak powinno, czyli odpowiednio zginając czujnik - rusza się serwomechanizm o dany kąt. Problem pojawia się gdy próbuję wysłać ten sygnał za pomocą bluetooth (być może kod jest zły, zaczerpnięty z internetu, ale komuś podobno działało, wstawię niżej). Moje moduły bluetooth zaprogramowałem wydaje mi się prawidłowo, jest między nimi połączenie (lecz musiałem je programować na arduino uno, bo na nano po wpisywaniu komend nic się nie działo). Domyślnie były one na 9600 baud rate. Układ z arduino nano jest moim masterem. Zmapowany sygnał z czujnika zginania wziąłem pod monitor i widać takie wartości: M332 L330 J331 K330 J331 K330 J330 Moim zdaniem powinny być same liczby, a nie jakieś cyferki dodatkowo. (może tu jest problem?) Układ z arduino uno jest slavem i biorąc pod monitor watości dostarczone tutaj otrzymuje: 13 10 83 51 51 51 10 51 Więc jakby liczby są prawidłowe, ale strasznie one skaczą i zginanie czujnika nie skutkuje zmianą tych wartości. Oto kod dla MASTERA: int val1; int state=0; void setup() { Serial.begin(9600); } void loop() { if(Serial.available() > 0){ // Checks whether data is comming from the serial port state = Serial.read(); // Reads the data from the serial por } val1 = analogRead(A0); // reads the value of the potentiometer (value between 0 and 1023) int val1map = map(val1, 0, 400, 0, 180); // scale it to use it with the servo (value between 0 and 180) Serial.println(val1map); Serial.write(val1map); delay(10); } Oto kod dla SLAVE'a: #include <Servo.h> Servo kciuk; // create servo object to control a servo int state=20; void setup() { kciuk.attach(5); // attaches the servo on pins to the servo object Serial.begin(9600); } void loop() { if(Serial.available() > 0){ // Checks whether data is comming from the serial port state = Serial.read(); } kciuk.write(state); Serial.println(state); delay(10); } Może arduino nano jakoś inaczej trzeba łączyć z bluetoothem? Ja oba bluetoothy połączyłem tak: RX z bluetooth'a do TX na arduino, TX z blue do RX na arduino, GND wiadomo do GND na arduino, Vcc do 5V na arduino. Potrzebuje pilnie pomocy i z góry dziękuję za każdą wiadomość!
  4. Cześć, nazywam się Filip i jestem tu nowy i nie wiem za wiele. Problem polega na błędzie z wgranie na płytkę, załączam screen - . Program jest z przykładów w celu sprawdzenia płytki i sprawić aby na arduino migała dioda. Jak to naprawić? Będę wdzięczny za pomoc.
  5. Witam. Mam problem z dwoma Arduino Nano (oczywiście klony z allegro) oraz dwoma modułami NRF24L01 (zakupionych na Aliexpress), mianowicie nie chcą one się połączyć. Już na początku przy przykładzie pingpair były problemy bo raz się łączyło raz nie. Szukałam innych przykładów na internecie i w ogóle nie działały, szukałam dalej i sprawę z stabilnym zasilaniem rozwiązałam poprzez stabilizator +3.3V, program nigdzie się nie zacina i połączenia sprawdzone po kilka razy. Nie mam już pomysłów co może być. Kod nadajnika: #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <RF24_config.h> int State1 = 0; RF24 radio(9, 10); const byte address[6] = "00002"; void setup() { Serial.begin(9600); pinMode(2, INPUT); radio.begin(); radio.openWritingPipe(address); radio.setPALevel (RF24_PA_LOW); radio.stopListening(); } void loop() { if (digitalRead(2) == 0) { State1 = 0; Serial.println("0"); } else{ State1 = 1; Serial.println("1"); } } Kod odbiornika: #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <RF24_config.h>// biblioteki int State1 = 0; RF24 radio(9, 10); // CE, CSN const byte address[6] = "00002"; void setup() { Serial.begin(9600); pinMode(5, OUTPUT); radio.begin(); radio.openReadingPipe(0, address); radio.setPALevel(RF24_PA_LOW); } void loop(){ radio.startListening(); radio.read(&State1, sizeof(State1)); Serial.println("start"); if (State1 == 1) { digitalWrite(5, LOW); Serial.println("1"); } else { digitalWrite(5, HIGH); Serial.println("0"); } Serial.println("koniec"); }
  6. Mam problem. Od dwóch dni próbuję stworzyć program, który będzie wyświetlał różne animacje. Chciałbym wrzucić kilka animacji do jednego programu, by móc potem zmieniać je poprzez naciśnięcie przycisku. Zaznaczam, że dopiero się uczę Arduino i jeżeli robię jakiś błąd posłucham rady od was. Podczas włączania animacji program nie chce jej odtworzyć, puszcza tylko jedną sekwencję. Chodzi o tryb 2. Trzeba użyć pętli? Jak tak to jak ją napisać? #include "FastLED.h" int buttonPin = 2; bool state = 0; int tryb = 0; //////////////////////////////////////////////////////////////////////////////////////////////////// // // RGB Calibration code // // Use this sketch to determine what the RGB ordering for your chipset should be. Steps for setting up to use: // * Uncomment the line in setup that corresponds to the LED chipset that you are using. (Note that they // all explicitly specify the RGB order as RGB) // * Define DATA_PIN to the pin that data is connected to. // * (Optional) if using software SPI for chipsets that are SPI based, define CLOCK_PIN to the clock pin // * Compile/upload/run the sketch // You should see six leds on. If the RGB ordering is correct, you should see 1 red led, 2 green // leds, and 3 blue leds. If you see different colors, the count of each color tells you what the // position for that color in the rgb orering should be. So, for example, if you see 1 Blue, and 2 // Red, and 3 Green leds then the rgb ordering should be BRG (Blue, Red, Green). // You can then test this ordering by setting the RGB ordering in the addLeds line below to the new ordering // and it should come out correctly, 1 red, 2 green, and 3 blue. // ////////////////////////////////////////////////// #define NUM_LEDS 10 // For led chips like WS2812, which have a data line, ground, and power, you just // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN // Clock pin only needed for SPI based chipsets when not using hardware SPI #define DATA_PIN 7 #define CLOCK_PIN 13 CRGB leds[NUM_LEDS]; void setup() { // sanity check delay - allows reprogramming if accidently blowing power w/leds delay(2000); Serial.begin(57600); Serial.println("resetting"); LEDS.setBrightness(10); pinMode(buttonPin, INPUT_PULLUP); pinMode(LED_BUILTIN, OUTPUT); // Uncomment/edit one of the following lines for your leds arrangement. // ## Clockless types ## // FastLED.addLeds<SM16703, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1829, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1812, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS1904, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<UCS2903, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical // FastLED.addLeds<WS2852, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical // FastLED.addLeds<GS1903, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SK6812, DATA_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<APA106, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<PL9823, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SK6822, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2813, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<APA104, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<GE8822, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<LPD1886, DATA_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<LPD1886_8BIT, DATA_PIN, RGB>(leds, NUM_LEDS); // ## Clocked (SPI) types ## // FastLED.addLeds<LPD6803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // GRB ordering is typical // FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<WS2803, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical // FastLED.addLeds<DOTSTAR, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical // FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical // FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); // BGR ordering is typical } void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } } void loop() { if(digitalRead(2) == HIGH ) // Jezeli wcisniemy przycisk podlaczony pod pin nr 2 { if(tryb != 2) tryb++; else tryb = 0; while(digitalRead(2) == HIGH); } if(tryb == 0) { leds[0] = CRGB(255,0,0); leds[1] = CRGB(255,0,0); leds[2] = CRGB(255,0,0); leds[3] = CRGB(255,0,0); leds[4] = CRGB(255,0,0); leds[5] = CRGB(255,0,0); leds[6] = CRGB(255,0,0); leds[7] = CRGB(255,0,0); leds[8] = CRGB(255,0,0); leds[9] = CRGB(255,0,0); FastLED.show(); delay(1); } if (tryb == 1) { leds[0] = CRGB(255,0,0); leds[1] = CRGB(0,255,0); leds[2] = CRGB(0,0,255); leds[3] = CRGB(0,255,0); leds[4] = CRGB(0,0,255); leds[5] = CRGB(0,0,255); leds[6] = CRGB(255,0,0); leds[7] = CRGB(0,0,255); leds[8] = CRGB(0,255,0); leds[9] = CRGB(0,0,255); FastLED.show(); delay(1); } if(tryb == 2) { static uint8_t hue = 0; Serial.print("x"); // First slide the led in one direction for(int i = 0; i < NUM_LEDS; i++) { // Set the i'th led to red leds[i] = CHSV(hue++, 255, 255); // Show the leds FastLED.show(); // now that we've shown the leds, reset the i'th led to black // leds[i] = CRGB::Black; fadeall(); // Wait a little bit before we loop around and do it again delay(10); } Serial.print("x"); // Now go in the other direction. for(int i = (NUM_LEDS)-1; i >= 0; i--) { // Set the i'th led to red leds[i] = CHSV(hue++, 255, 255); // Show the leds FastLED.show(); // now that we've shown the leds, reset the i'th led to black // leds[i] = CRGB::Black; fadeall(); // Wait a little bit before we loop around and do it again delay(10); } } }
×
×
  • Utwórz nowe...

Ważne informacje

Ta strona używa ciasteczek (cookies), dzięki którym może działać lepiej. Więcej na ten temat znajdziesz w Polityce Prywatności.