This file contains 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
init: ; Steven Smethurst, 2022. Based on Hackaday-dice-roll by Tom Nardi | |
mov r0, 2 ; Set matrix page | |
mov [0xF0], r0 | |
mov r0, 5 ; Set CPU speed | |
mov [0xF1], r0 | |
main: | |
gosub getroll ; Put random number in R1 | |
mov r2, 1 ; Subtract 1 from result to get mem address |
This file contains 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
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(); |
This file contains 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
int main() { | |
ConnectTCP(); | |
LoadModbusFunctions(); | |
ModbusStack_Init( MODBUS_TCP, sendModbusMessage, recvModbusMessage, currentTime); | |
ModbusStack_SetSlaveId( MODBUS_SLAVE_ADDRESS ); | |
ModbusStack_RegisterGetValue(getModbusValue); | |
for(;;) { | |
ModbusStack_Loop(); | |
} | |
} |
This file contains 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
// 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; |
This file contains 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
<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> |
This file contains 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 "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: |
This file contains 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
int main() { | |
ConnectUDP(); | |
SetupCallbacks(); | |
AddDevice(389001) ; | |
AddObject(389001, ANALOG_INPUT, 101); | |
AddObject(389001, BINARY_OUTPUT, 102); | |
AddObject(389001, MULTI_STATE_VALUE, 103); | |
... |
This file contains 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
''' | |
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)" |
This file contains 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
/* | |
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() { |
NewerOlder