Skip to content

Instantly share code, notes, and snippets.

Steven Smethurst funvill

Block or report user

Report or block funvill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Goldhunt
https://docs.google.com/document/d/1UukqPw6TmzNuxsnJQK_7XppFXCz_lBMTWBK_Rgt6Fcw/edit
View Adafruit_INA219_multiple.ino
const int NUMBER_OF_CHANNELS = 8;
Adafruit_INA219 ina219[NUMBER_OF_CHANNELS]{ 0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48 };
for (int channel = 0; channel < NUMBER_OF_CHANNELS; channel++) {
ina219[channel].begin();
}
for (int channel = 0; channel < NUMBER_OF_CHANNELS; channel++) {
int busvoltage = ina219[channel].getBusVoltage_V();
int current_mA = ina219[channel].getCurrent_mA();
View SimpleModbusTCPExample.c
int main() {
ConnectTCP();
LoadModbusFunctions();
ModbusStack_Init( MODBUS_TCP, sendModbusMessage, recvModbusMessage, currentTime);
ModbusStack_SetSlaveId( MODBUS_SLAVE_ADDRESS );
ModbusStack_RegisterGetValue(getModbusValue);
for(;;) {
ModbusStack_Loop();
}
}
@funvill
funvill / demo100Button.ino
Created Mar 3, 2019
The demo 100 from fast led with three buttons
View demo100Button.ino
#include "FastLED.h"
FASTLED_USING_NAMESPACE
#include <EasyButton.h>
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.
//
@funvill
funvill / bacnet-iam.cpp
Last active Jul 31, 2018
Sending a BACnet I-AM via BACnet stack 1.x version
View bacnet-iam.cpp
// http://bacnetstack.com/
// To be a good BACnet Server we should announce our-self when joining a network.
// Generate the IAM message and send it.
char packet[MAXIMUM_BACNET_MESSAGE];
unsigned short payloadSize = fpIAm(SETTING_SERVER_BACNET_NETWORK, (unsigned char *)&deviceOffset, sizeof(unsigned int), packet, MAXIMUM_BACNET_MESSAGE, deviceOffset);
if (payloadSize > 0) {
// Generate the connection string.
BYTE connectionString[10];
sscanf_s("255.255.255.255", "%d.%d.%d.%d", &connectionString[0], &connectionString[1], &connectionString[2], &connectionString[3]);
connectionString[4] = SETTING_BACNET_UDP_PORT / 256;
View BACnetPacket.xml
<BACnetPacket networkType='IP'>
<BVLL function='originalUnicastNPDU'/>
<NPDU control='0x08' version='1'>
<SourceNetwork>389</SourceNetwork>
<SourceAddress length='3'>0x05F17D</SourceAddress>
</NPDU>
<ComplexACKPDU moreFollows='0' originalInvokeId='74' segmentedMessage='0' serviceChoice='readProperty'>
<ReadPropertyACK>
<ObjectIdentifier context='0' datatype='12' objectInstance='389501' objectType='8'>device, 389501</ObjectIdentifier>
<PropertyIdentifier context='1' datatype='9' value='11'>apduTimeout</PropertyIdentifier>
View USBtoRS485Test.cpp
#include "HardwareSerial.h"
HardwareSerial SerialTwo(2);
const char PIN_RS485 = 14;
const unsigned short lineDriveOff = 10;
const unsigned short lineDriveOn = 3;
void setup() {
// initialize serial communications at 9600 bps:
View SimplifiedBACnetStackExample.c
int main() {
ConnectUDP();
SetupCallbacks();
AddDevice(389001) ;
AddObject(389001, ANALOG_INPUT, 101);
AddObject(389001, BINARY_OUTPUT, 102);
AddObject(389001, MULTI_STATE_VALUE, 103);
...
@funvill
funvill / kangarooword.py
Last active Mar 27, 2018
Working on kangaroo word generator in python.... not finished.
View kangarooword.py
'''
Created by: Steven Smethurst
Created on: March 26, 2018
http://blog.abluestar.com
'''
from itertools import chain
from itertools import combinations
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
@funvill
funvill / print.cpp
Created Feb 22, 2018
Arduino serial print sketch
View print.cpp
/*
Uses a FOR loop for data and prints a number in various formats.
*/
int x = 0; // variable
void setup() {
Serial.begin(9600); // open the serial port at 9600 bps:
}
void loop() {
You can’t perform that action at this time.