This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <ESP8266WiFi.h> | |
| #include <ESP8266HTTPClient.h> | |
| #include <WiFiClientSecure.h> | |
| #include <time.h> | |
| const char* ssid = "<id>"; | |
| const char* password = "<pwd>"; | |
| const String FIREBASE_PROJECT_ID = "<id>"; | |
| const String API_KEY = "<api_key>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Arduino.h> | |
| #include <ThreeWire.h> | |
| #include <RtcDS1302.h> | |
| #define PIN_CLK D5 | |
| #define PIN_DAT D7 | |
| #define PIN_RST D8 | |
| #define RELAY_PIN D1 // Relay control pin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library | |
| #from time import sleep # Import the sleep function from the time module | |
| import os | |
| import csv | |
| r = csv.reader(open('/home/pi/Desktop/hydroponic_project/relay_running_count.csv')) # Here your csv file | |
| lines = list(r) | |
| original = lines[0][0] | |
| print(lines[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| import os | |
| import csv | |
| GPIO.setmode(GPIO.BCM) | |
| #pin bawah skali, seblah ground | |
| GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library | |
| from time import sleep # Import the sleep function from the time module | |
| GPIO.setwarnings(False) # Ignore warning for now | |
| GPIO.setmode(GPIO.BOARD) # Use physical pin numbering | |
| GPIO.setup(8, GPIO.OUT, initial=GPIO.LOW) # Set pin 8 to be an output pin and s$ | |
| while True: # Run forever | |
| GPIO.output(8, GPIO.HIGH) # Turn on | |
| sleep(1) # Sleep for 1 second -> use this to set the interval for water pump | |
| GPIO.output(8, GPIO.LOW) # Turn off | |
| sleep(1) # Sleep for 1 second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Copyright (c) 2017-18 Richard Hull and contributors | |
| # See LICENSE.rst for details. | |
| import re | |
| import time | |
| import argparse | |
| from luma.led_matrix.device import max7219 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Crops | |
| attr_accessor :sam #declare a variable named sam here | |
| attr_accessor :luke #declare a variable named luke here | |
| def initialize() | |
| @sam = ["apple", "carrot"] #declare that sam has what | |
| @luke = ["carrot"] #declare that luke has what | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "Please select crop number and separated by comma if more than one : \n 1) apple \n 2) pear" | |
| a = gets.chomp | |
| #receive string with comma separated | |
| b = a.split(",") | |
| # puts "#{b}" | |
| b.each do |x| | |
| #received string. convert to integer first |
NewerOlder