Skip to content

Instantly share code, notes, and snippets.

View marcozecchini's full-sized avatar

Marco Zecchini marcozecchini

View GitHub Profile
#define TdsSensorPin A1
#define VREF 5.0 // analog reference voltage(Volt) of the ADC
#define SCOUNT 30 // sum of sample point
int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADC
int analogBufferTemp[SCOUNT];
int analogBufferIndex = 0,copyIndex = 0;
float averageVoltage = 0,tdsValue = 0,temperature = 25;
void setup()
{
#!/usr/local/bin/python
#https://docs.python.org/2/library/multiprocessing.html
#https://www.geeksforgeeks.org/synchronization-pooling-processes-python/
import multiprocessing
import RPi.GPIO as GPIO
import os
import time
GPIO.setmode(GPIO.BCM)
#define SensorPin A3 //pH meter Analog output to Arduino Analog Input 0
#define Offset 0.04 //deviation compensate
#define first_ph_reference_voltage 1.73
#define first_standard_solution 6.7
#define second_ph_reference_voltage 1.29
#define second_standard_solution 4.1
#define LED 13
#define samplingInterval 1000
#define printInterval 1000
#define ArrayLenth 40 //times of collection
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <OneWire.h>
#define DoSensorPin A4 //dissolved oxygen sensor analog output pin to arduino mainboard
#define TemperaturePin A0
#define VREF 5000 //for arduino uno, the ADC reference is the AVCC, that is 5000mV(TYP)
float doValue; //current dissolved oxygen value, unit; mg/L
float temperature = 25; //default temperature is 25^C, you can use a temperature sensor to read it
Company 1
Measurements 4.5 5.5 8.5 7.8 9.0
Percentage 80% 60% 40% 20% 10%
Threshold 4.0 4.5 6.5 8.0 9.0
Company 2
Measurements 3.5 3.8 6.0 8.5 9.0
Percentage 80% 60% 40% 20% 10%
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("+/devices/+/up")
# The callback for when a PUBLISH message is received from the server.
const fs = require('fs');
const path = require('path');
const algosdk = require('algosdk');
const { countReset } = require('console');
const baseServer = 'https://testnet-algorand.api.purestake.io/ps2';
const port = '';
const token = {
'X-API-Key': 'F9I45UDrFb9FuoYhohD35A2Tcfq0mnZ5cTuG81x9',
@marcozecchini
marcozecchini / contracts...ERC-721.sol
Created July 1, 2021 15:12
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
/**
* @dev This is an example contract implementation of NFToken with metadata extension.
*/
@marcozecchini
marcozecchini / contracts...SimpleAuction.sol
Created July 27, 2021 16:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
/**
* @dev This is an example contract implementation of NFToken with metadata extension.
*/
import "/contracts/MyPostiToken.sol";
contract SimpleAuction {
@marcozecchini
marcozecchini / contracts...SimpleAuction.sol
Created July 27, 2021 16:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
/**
* @dev This is an example contract implementation of NFToken with metadata extension.
*/
import "/contracts/MyPostiToken.sol";
contract SimpleAuction {