Kombajn arduino

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

Post

pzygmunt wrote: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>
chyba nie dokońca to działa :)

Code: Select all

// CHANNEL3 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(3,     // 46 - Pin number where the 1st relay is connected   
                             5);    // 47 - Pin number where the 2nd relay is connected  
czy dało by rade zrobić tak

roleta do góry załącza sie pin 5

roleda w dół załącza sie pin 5 i 3
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

No samo nie zadziała.


void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {


digitalWrite(pin, val);

if ( pin == 3 )
digitalWrite(5, val);
}
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

pzygmunt wrote:No samo nie zadziała.


void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {


digitalWrite(pin, val);

if ( pin == 3 )
digitalWrite(5, val);
}
Dziękuje teraz działą :)

mogę jeszcze pomarudzi , troszkę ;)

do ideału brakuje (oczywiście moja sugestia)

zazwyczaj rolety sterowane są takimi silnikami

http://allegro.pl/show_item.php?item=6229493320

schemat podłaczenia

i ma wbudowane krańcówki ale lepiej by po zadanym czasie sie wyłączył przekąznik np 0-30s

.Reasumując naciskam raz przycisk roleta sie rozwija (załacza sie pin3) po zadanej zwłoce czasowej 0-30 sekund wyłącza sie przekaznik.
zwijanie klikamy w aplikacji zwijanie ząłcza sie pin3i5 i po zadanej zwłoce czasowej 0-30 sekund wyłącza sie przekazniki.
You do not have the required permissions to view the files attached to this post.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

szkoda , że sterowanie led nie działą na ipadzie,iphonie.
Tak działa TV lift (przydała by sie inna ikonka w aplikacji )


https://www.youtube.com/watch?v=QCJaHF5G7CM
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

Witam dodałem czujnik dht22 ale aplikacji pokazuje mi 2 sztuki

w czym może byc problem ?

P.S macie pomysł jak zrobić czujnik temperatury który był by na dworzu ?

Musiał by być zasilany z akumulatora (bateri ) i łączyć sie z arduino bezprzewodowo

Code: Select all

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

/*
 * SUPLA DEVICE - ARDUINO - ETHERNET SHIELD
 * Author: Przemyslaw Zygmunt <[email protected]>
 *
 */
#define DHTPIN 24
#define DHTTYPE DHT22
 #define RED_PIN    44
 #define GREEN_PIN  45
 #define BLUE_PIN   46
 #define BRIGHTNESS_PIN        7
 #define COLOR_BRIGHTNESS_PIN  8
 // Setup a DHT instance
DHT dht(DHTPIN, DHTTYPE);
// DS18B20 Sensor read implementation
void get_temperature_and_humidity(int channelNumber, double *temp, double *humidity) {

    *temp = dht.readTemperature();
    *humidity = dht.readHumidity();

    if ( isnan(*temp) || isnan(*humidity) ) {
      *temp = -275;
      *humidity = -1;
    }

}
 unsigned char _red = 0;
 unsigned char _green = 255;
 unsigned char _blue = 0;
 unsigned char _color_brightness = 0;
 unsigned char _brightness = 0;

void get_rgbw_value(int channelNumber, unsigned char *red, unsigned char *green, unsigned char *blue, unsigned char *color_brightness, unsigned char *brightness) {

  *brightness = _brightness;
  *color_brightness= _color_brightness;

  *red = _red;
  *green = _green;
  *blue = _blue;

}

void set_rgbw() {
    
    analogWrite(BRIGHTNESS_PIN, (_brightness * 255) / 100);
    analogWrite(COLOR_BRIGHTNESS_PIN, (_color_brightness * 255) / 100);
    analogWrite(RED_PIN, _red);
    analogWrite(GREEN_PIN, _green);
    analogWrite(BLUE_PIN, _blue);
}

void set_rgbw_value(int channelNumber, unsigned char red, unsigned char green, unsigned char blue, unsigned char color_brightness, unsigned char brightness) {

    _brightness = brightness;
    _color_brightness= color_brightness;
  
    _red = red;
    _green = green;
    _blue = blue;  
    
    set_rgbw();
  
}
void suplaDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) {
digitalWrite(pin, val); 
if ( pin == 3 )
digitalWrite(5, val);
}




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

  Serial.begin(9600);
  // Init DHT library 
  dht.begin(); 
  
  // Set temperature/humidity callback
  SuplaDevice.setTemperatureHumidityCallback(&get_temperature_and_humidity);
 
  set_rgbw();
  
  // Set RGBW callbacks
  SuplaDevice.setRGBWCallbacks(&get_rgbw_value, &set_rgbw_value);

  // Replace the falowing GUID
  char GUID[SUPLA_GUID_SIZE] = {0000000000000};
  // 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.addRgbControllerAndDimmer();    


 SuplaDevice.addRollerShutterRelays(3, 5);
  SuplaDevice.addRollerShutterRelays(27, 29, true);
   SuplaDevice.addRollerShutterRelays(31, 33, true);
    SuplaDevice.addRollerShutterRelays(35, 37, true);
     SuplaDevice.addRollerShutterRelays(39, 41, true);
     
  // 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


  // CHANNEL6 - DHT22 Sensor
  // SuplaDevice.addDHT11();
  // SuplaDevice.addAM2302();
  SuplaDevice.addDHT22();

        
  /*
   * 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
                    ,                // Location ID - TU WKLEJASZ SWÓJ ID
                    "");           // Location Password - W NAWIASIE WKLEJASZ HASŁO
    
}

void loop() {
  SuplaDevice.iterate();
}
You do not have the required permissions to view the files attached to this post.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

Może w cloud.supla.org masz jeszcze jedno urządzenie ?
SUPLA.... Nareszcie w domu.
User avatar
nowy1
Posts: 339
Joined: Fri Jul 01, 2016 11:51 am
Location: Warszawa

Post

pzygmunt wrote:Może w cloud.supla.org masz jeszcze jedno urządzenie ?

nie
You do not have the required permissions to view the files attached to this post.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

To nie jest lista urządzeń tylko lista kanałów.
SUPLA.... Nareszcie w domu.
User avatar
shimano73
Posts: 2174
Joined: Sun Feb 28, 2016 12:27 pm
Location: Orzesze
Been thanked: 1 time

Post

Pytanie z innej beczki czy arduino musi być zasilane z zasilacza czy wystarczy usb z PC ?
W elektronice jak nie wiadomo o co chodzi to zwykle chodzi o zasilanie

Wezmę udział w Supla Offline Party 2024 :)
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

W zależności od PC z USB możesz uwalić port przy większym obciążeniu.
SUPLA.... Nareszcie w domu.

Return to “Pomoc”