Kombajn arduino

User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

Witam,

mam pytanie czy jest możliwość dla arduino zrobić "kombain"

czyli obsług RGB
rolet
czujnika temperatury
Jeszcze jedno pytanie czy jest możliwość obsługi tego wszystkiego jeszcze pilotem ir ?
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Na oba pytania odpowiedź brzmi tak.
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

pzygmunt wrote:Na oba pytania odpowiedź brzmi tak.

Dziękuje za odpowiedzi ,czy jesteś w stanie naprowadzić jak to zrobić ?

oczywiście wędkę nie rybe ;)

i jak załączyć dwa przekaźniki naraz ? np port 44 i 45
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Wydaje mi się, że dostępne przykłady
https://github.com/SUPLA/arduino/tree/m ... e/examples

same w sobie są podpowiedzią... ale może mi się tylko wydawać.
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

Oki połączyć kody zmienić porty to rozumiem ,a załączenie dwóch przekaźników na raz ?
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Pobierz sobie najnowszą wersję biblioteki dla Arduino (ArduinoSuplaDevice).

Przed funkcja setup dodaj:

void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {
digitalWrite(pin, val);
}

W funkcji setup na samym początku dodaj:

SuplaDevice.setDigitalWriteFuncImpl(&suplaDigitalWrite);


teraz w suplaDigitalWrite możesz sobie sprawdzić, że jak włączany jest określony przekaźnik to włączasz od razu drugi.
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

pzygmunt wrote:Pobierz sobie najnowszą wersję biblioteki dla Arduino (ArduinoSuplaDevice).

Przed funkcja setup dodaj:

void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {
digitalWrite(pin, val);
}

W funkcji setup na samym początku dodaj:

SuplaDevice.setDigitalWriteFuncImpl(&suplaDigitalWrite);


teraz w suplaDigitalWrite możesz sobie sprawdzić, że jak włączany jest określony przekaźnik to włączasz od razu drugi.

witam,

czy tak ma wyglądac kod ?

Code: Select all

/*
 * SUPLA DEVICE - ARDUINO - ENC28J60
 * Author: Przemyslaw Zygmunt <[email protected]>
 *
 * This example requires UIPEthernet library installed. 
 * https://github.com/ntruchsess/arduino_uip 
 */
void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {
digitalWrite(pin, val); 
}

void setup() {
  
  SuplaDevice.setDigitalWriteFuncImpl(&suplaDigitalWrite);

Serial.begin(9600);
 
bo mam problem z wgraniem
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

To jest cały kod czy tylko początek ?
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

pzygmunt wrote:To jest cały kod czy tylko początek ?
początek dodam cały

Code: Select all

#include <eh.h>
#include <IEEE754tools.h>
#include <lck.h>
#include <log.h>
#include <proto.h>
#include <srpc.h>
#include <SuplaDevice.h>

#include <Ethernet.h>
#include <SuplaDevice.h>


/*
 * SUPLA DEVICE - ARDUINO - ENC28J60
 * Author: Przemyslaw Zygmunt <[email protected]>
 *
 * This example requires UIPEthernet library installed. 
 * https://github.com/ntruchsess/arduino_uip 
 */
void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {
digitalWrite(pin, val); 
}

void setup() {
  
  SuplaDevice.setDigitalWriteFuncImpl(&suplaDigitalWrite);

Serial.begin(9600);
 
  // Replace the falowing GUID
  char GUID[SUPLA_GUID_SIZE] = {0000000000000000000};
  // with GUID that you can retrieve from https://www.supla.org/arduino/get-guid


  // Ethernet MAC address
  uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};

  /*
   * Having your device already registered at cloud.supla.org,
   * you want to change CHANNEL sequence or remove any of them,
   * then you must also remove the device itself from cloud.supla.org.
   * Otherwise you will get "Channel conflict!" error.
   */
    
  // CHANNEL0 - RELAY
  SuplaDevice.addRelay(44);           // 44 - Pin number where the relay is connected      
                                      // Call SuplaDevice.addRelay(44, true) with an extra "true" parameter 
                                      // to enable "port value inversion"
                                      // where HIGH == LOW, and LOW == HIGH   

  // CHANNEL1 - RELAY
  SuplaDevice.addRelay(45);           // 45 - Pin number where the relay is connected   

  // CHANNEL3 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(46,     // 46 - Pin number where the 1st relay is connected   
                             47,true);    // 47 - Pin number where the 2nd relay is connected  

  // CHANNEL4 - Opening sensor (Normal Open)
  SuplaDevice.addSensorNO(A0); // A0 - Pin number where the sensor is connected
                               // Call SuplaDevice.addSensorNO(A0, true) with an extra "true" parameter
                               // to enable the internal pull-up resistor


  // CHANNEL5 - Opening sensor (Normal Open)
  SuplaDevice.addSensorNO(A1); // A1 - Pin number where the sensor is connected

  /*
   * SuplaDevice Initialization.
   * Server address, LocationID and LocationPassword are available at https://cloud.supla.org 
   * If you do not have an account, you can create it at https://cloud.supla.org/account/create
   * SUPLA and SUPLA CLOUD are free of charge
   * 
   */
 
  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    mac,               // Ethernet MAC address
                    "svr1.supla.org",  // SUPLA server address
                   0000,                // Location ID 
                    "00002");           // Location Password
    
}

void loop() {
  SuplaDevice.iterate();
}
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Z:

#include <eh.h>
#include <IEEE754tools.h>
#include <lck.h>
#include <log.h>
#include <proto.h>
#include <srpc.h>
#include <SuplaDevice.h>

#include <Ethernet.h>
#include <SuplaDevice.h>

Zostaw tylko:


#include <Ethernet.h>
#include <SuplaDevice.h>
SUPLA.... Nareszcie w domu.

Return to “Pomoc”