move to Platformio
This commit is contained in:
parent
5507d20039
commit
aea9cc389b
|
@ -0,0 +1 @@
|
||||||
|
.DS_Store
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,194 @@
|
||||||
|
:100000000C9462000C948A000C948A000C948A0070
|
||||||
|
:100010000C948A000C948A000C948A000C948A0038
|
||||||
|
:100020000C948A000C948A000C948A000C948A0028
|
||||||
|
:100030000C948A000C948A000C948A000C948A0018
|
||||||
|
:100040000C949E010C948A000C940E020C94E8010E
|
||||||
|
:100050000C948A000C948A000C948A000C948A00F8
|
||||||
|
:100060000C948A000C948A000000000025002800EF
|
||||||
|
:100070002B0000000000240027002A0000000000E0
|
||||||
|
:1000800023002600290004040404040404040202DA
|
||||||
|
:100090000202020203030303030301020408102007
|
||||||
|
:1000A0004080010204081020010204081020000012
|
||||||
|
:1000B0000008000201000003040700000000000027
|
||||||
|
:1000C0000000600411241FBECFEFD8E0DEBFCDBF1B
|
||||||
|
:1000D00011E0A0E0B1E0E6ECFBE002C005900D927B
|
||||||
|
:1000E000A833B107D9F721E0A8E3B1E001C01D9220
|
||||||
|
:1000F000AE3FB207E1F710E0C2E6D0E004C02197BE
|
||||||
|
:10010000FE010E94B504C136D107C9F70E94400222
|
||||||
|
:100110000C94E1050C940000CF92DF92EF92FF92D5
|
||||||
|
:100120000F931F93CF93DF936C017A018B01C0E093
|
||||||
|
:10013000D0E0CE15DF0581F0D8016D918D01D6019B
|
||||||
|
:10014000ED91FC910190F081E02DC6010995892B7C
|
||||||
|
:1001500011F02196EECF7E01C701DF91CF911F9163
|
||||||
|
:100160000F91FF90EF90DF90CF900895089580E079
|
||||||
|
:1001700090E00895FC01538D448D252F30E0842FAD
|
||||||
|
:1001800090E0821B930B541710F0CF9608950197BF
|
||||||
|
:100190000895FC01918D828D981761F0828DDF01A9
|
||||||
|
:1001A000A80FB11D5D968C91928D9F5F9F73928F6A
|
||||||
|
:1001B00090E008958FEF9FEF0895FC01918D828D5F
|
||||||
|
:1001C000981731F0828DE80FF11D858D90E008952C
|
||||||
|
:1001D0008FEF9FEF0895FC01918D228D892F90E084
|
||||||
|
:1001E000805C9F4F821B91098F739927089588E344
|
||||||
|
:1001F00091E00E94EB0021E0892B09F420E0822F9E
|
||||||
|
:100200000895FC01848DDF01A80FB11DA35ABF4FD3
|
||||||
|
:100210002C91848D90E001968F739927848FA68905
|
||||||
|
:10022000B7892C93A089B1898C91837080648C9359
|
||||||
|
:10023000938D848D981306C00288F389E02D808108
|
||||||
|
:100240008F7D80830895EF92FF920F931F93CF933A
|
||||||
|
:10025000DF93EC0181E0888F9B8D8C8D981305C016
|
||||||
|
:10026000E889F989808185FD26C0F62E0B8D10E086
|
||||||
|
:100270000F5F1F4F0F731127E02E8C8DE8120CC0FB
|
||||||
|
:100280000FB607FCFACFE889F989808185FFF5CFA1
|
||||||
|
:10029000CE010E940101F1CF8B8DFE01E80FF11D0F
|
||||||
|
:1002A000E35AFF4FF0829FB7F8940B8FEA89FB89DE
|
||||||
|
:1002B000808180620AC09FB7F894EE89FF896083CD
|
||||||
|
:1002C000E889F98980818370806480839FBF81E0A1
|
||||||
|
:1002D00090E0DF91CF911F910F91FF90EF900895E3
|
||||||
|
:1002E000CF93DF93EC01888D8823C9F0EA89FB89DD
|
||||||
|
:1002F000808185FD05C0A889B9898C9186FD0FC0D4
|
||||||
|
:100300000FB607FCF5CF808185FFF2CFA889B989A8
|
||||||
|
:100310008C9185FFEDCFCE010E940101E7CFDF91E7
|
||||||
|
:10032000CF91089580E090E0892B29F00E94F7009A
|
||||||
|
:1003300081110C94000008950E94DC051F920F9219
|
||||||
|
:100340000FB60F9211242F933F938F939F93AF93E8
|
||||||
|
:10035000BF938091F6019091F701A091F801B091BF
|
||||||
|
:10036000F9013091F50123E0230F2D3720F4019698
|
||||||
|
:10037000A11DB11D05C026E8230F0296A11DB11DC8
|
||||||
|
:100380002093F5018093F6019093F701A093F80173
|
||||||
|
:10039000B093F9018091F1019091F201A091F301E4
|
||||||
|
:1003A000B091F4010196A11DB11D8093F1019093CC
|
||||||
|
:1003B000F201A093F301B093F401BF91AF919F912B
|
||||||
|
:1003C0008F913F912F910F900FBE0F901F90189516
|
||||||
|
:1003D0001F920F920FB60F9211242F933F934F93BA
|
||||||
|
:1003E0005F936F937F938F939F93AF93BF93EF939D
|
||||||
|
:1003F000FF9388E391E00E940101FF91EF91BF918B
|
||||||
|
:10040000AF919F918F917F916F915F914F913F91AC
|
||||||
|
:100410002F910F900FBE0F901F9018951F920F9263
|
||||||
|
:100420000FB60F9211242F938F939F93EF93FF9307
|
||||||
|
:10043000E0914801F09149018081E0914E01F091F5
|
||||||
|
:100440004F0182FD12C09081809151018F5F8F73A7
|
||||||
|
:1004500020915201821751F0E0915101F0E0E85CE7
|
||||||
|
:10046000FE4F958F8093510101C08081FF91EF91E4
|
||||||
|
:100470009F918F912F910F900FBE0F901F90189505
|
||||||
|
:10048000789484B5826084BD84B5816084BD85B56F
|
||||||
|
:10049000826085BD85B5816085BD80916E0081607B
|
||||||
|
:1004A00080936E0010928100809181008260809321
|
||||||
|
:1004B0008100809181008160809381008091800023
|
||||||
|
:1004C0008160809380008091B10084608093B1004E
|
||||||
|
:1004D0008091B00081608093B00080917A00846048
|
||||||
|
:1004E00080937A0080917A00826080937A00809174
|
||||||
|
:1004F0007A00816080937A0080917A00806880938E
|
||||||
|
:100500007A001092C100E0914801F091490182E027
|
||||||
|
:100510008083E0914401F09145011082E091460111
|
||||||
|
:10052000F0914701108210925001E0914C01F0913E
|
||||||
|
:100530004D0186E08083E0914A01F0914B0180817A
|
||||||
|
:1005400080618083E0914A01F0914B018081886055
|
||||||
|
:100550008083E0914A01F0914B0180818068808323
|
||||||
|
:10056000E0914A01F0914B0180818F7D808383EE81
|
||||||
|
:1005700091E09093D8018093D7018EE08093D901C8
|
||||||
|
:1005800088E391E09093D6018093D5018FE090E0CD
|
||||||
|
:100590000E94BB049093DB018093DA0128E331E0F1
|
||||||
|
:1005A000A8E1B1E08D919D919927FC01E656FF4F9E
|
||||||
|
:1005B0004491FC01EA57FF4F84918823C9F090E0F1
|
||||||
|
:1005C000880F991FFC01EE58FF4FC591D491FC0193
|
||||||
|
:1005D000E859FF4F659174919FB7F8948881542F23
|
||||||
|
:1005E000509585238883EB01E8814E2B48839FBF7C
|
||||||
|
:1005F0002A173B07B9F6ECEAF0E02491E8E9F0E0CD
|
||||||
|
:1006000084918823C1F090E0880F991FFC01EE5877
|
||||||
|
:10061000FF4FC591D491FC01E859FF4FA591B491CA
|
||||||
|
:100620009FB7F8948881E22FE0958E2388838C9180
|
||||||
|
:10063000E823EC939FBFC12CD12C7601C39414E422
|
||||||
|
:10064000CDECD0E0A8E1B1E0812C912C540120E068
|
||||||
|
:1006500030E08D919D919927FC01E255FF4F449127
|
||||||
|
:10066000FC01E656FF4F6491FC01EA57FF4FE4910D
|
||||||
|
:10067000EE23A9F1442339F1433091F038F44130AD
|
||||||
|
:10068000A9F0423001F584B58F7D12C0473091F05A
|
||||||
|
:100690004830A1F04430B9F4809180008F7D03C0D0
|
||||||
|
:1006A000809180008F77809380000DC084B58F7714
|
||||||
|
:1006B00084BD09C08091B0008F7703C08091B000E5
|
||||||
|
:1006C0008F7D8093B000F0E0EE0FFF1FE458FF4FE6
|
||||||
|
:1006D00045915491FA018081682309F0CBC0B7019C
|
||||||
|
:1006E000A601022E04C0440F551F661F771F0A94EF
|
||||||
|
:1006F000D2F7842A952AA62AB72A2F5F3F4F2031A6
|
||||||
|
:10070000310509F0A6CF10937C0080917A008064B7
|
||||||
|
:1007100080937A0080917A0086FDFCCF80917800EA
|
||||||
|
:100720002091790090E0922BBE010E948D0480E11F
|
||||||
|
:1007300090E09C01205131092617370709F0ADC020
|
||||||
|
:1007400026013701082E04C0440C551C661C771C7A
|
||||||
|
:100750000A94D2F784289528A628B72801968531CF
|
||||||
|
:10076000910539F78092ED019092EE01A092EF0190
|
||||||
|
:10077000B092F0012FB7F8948091F6019091F701B3
|
||||||
|
:10078000A091F801B091F9012FBF4091DF01509184
|
||||||
|
:10079000E0016091E1017091E201841B950BA60BD1
|
||||||
|
:1007A000B70B0B97A105B10508F461C09090D90172
|
||||||
|
:1007B0008091D5019091D601DC01ED91FC910190E1
|
||||||
|
:1007C000F081E02D66E009958091D5019091D601E8
|
||||||
|
:1007D000DC01ED91FC910190F081E02D65E8099537
|
||||||
|
:1007E0008091D5019091D601DC01ED91FC910190B1
|
||||||
|
:1007F000F081E02D6091D9010995A12CB12C2091B7
|
||||||
|
:10080000D90130E08091D5019091D601A216B306AE
|
||||||
|
:100810009CF4E091D701F091D801EA0DFB1D6081B5
|
||||||
|
:100820009626DC01ED91FC910190F081E02D099577
|
||||||
|
:10083000BFEFAB1ABB0AE3CFDC01ED91FC91019055
|
||||||
|
:10084000F081E02D692D09952FB7F8948091F6017C
|
||||||
|
:100850009091F701A091F801B091F9012FBF809319
|
||||||
|
:10086000DF019093E001A093E101B093E2010E94C7
|
||||||
|
:100870009201E8CEB701A601022E04C0440F551F15
|
||||||
|
:10088000661F771F0A94D2F7409550956095709532
|
||||||
|
:1008900084229522A622B72230CF26013701082EC6
|
||||||
|
:1008A00004C0440C551C661C771C0A94D2F7409473
|
||||||
|
:1008B00050946094709484209520A620B7204ECF49
|
||||||
|
:1008C000E8E3F1E01382128288EE93E0A0E0B0E06A
|
||||||
|
:1008D00084839583A683B7838AE091E091838083A4
|
||||||
|
:1008E00085EC90E09587848784EC90E097878687F5
|
||||||
|
:1008F00080EC90E0918B808B81EC90E0938B828BED
|
||||||
|
:1009000082EC90E0958B848B86EC90E0978B868BC5
|
||||||
|
:10091000118E128E138E148E089597FB072E16F4E7
|
||||||
|
:10092000009407D077FD09D00E94A10407FC05D0F0
|
||||||
|
:100930003EF4909581959F4F0895709561957F4FF6
|
||||||
|
:100940000895AA1BBB1B51E107C0AA1FBB1FA61716
|
||||||
|
:10095000B70710F0A61BB70B881F991F5A95A9F768
|
||||||
|
:1009600080959095BC01CD010895EE0FFF1F059075
|
||||||
|
:10097000F491E02D09940F931F93CF93DF9382306E
|
||||||
|
:10098000910510F482E090E0E091FC01F091FD010E
|
||||||
|
:1009900020E030E0A0E0B0E0309719F140815181D3
|
||||||
|
:1009A0000281138148175907C8F08417950769F425
|
||||||
|
:1009B000109731F012960C93129713961C9327C040
|
||||||
|
:1009C0000093FC011093FD0122C02115310519F09F
|
||||||
|
:1009D0004217530718F49A01BD01EF01DF01F80136
|
||||||
|
:1009E000DBCF21153105F9F0281B390B24303105F7
|
||||||
|
:1009F00080F48A819B816115710521F0FB0193834D
|
||||||
|
:100A0000828304C09093FD018093FC01FE01329625
|
||||||
|
:100A100044C0FE01E20FF31F8193919322503109EC
|
||||||
|
:100A2000398328833AC02091FA013091FB01232BAE
|
||||||
|
:100A300041F420910201309103013093FB01209396
|
||||||
|
:100A4000FA0120910001309101012115310541F495
|
||||||
|
:100A50002DB73EB74091040150910501241B350B81
|
||||||
|
:100A6000E091FA01F091FB01E217F307A0F42E1BCD
|
||||||
|
:100A70003F0B2817390778F0AC014E5F5F4F241702
|
||||||
|
:100A8000350748F04E0F5F1F5093FB014093FA016A
|
||||||
|
:100A90008193919302C0E0E0F0E0CF01DF91CF912C
|
||||||
|
:100AA0001F910F910895CF93DF93009709F481C0B0
|
||||||
|
:100AB000FC01329713821282A091FC01B091FD01DA
|
||||||
|
:100AC000109781F420813181820F931F2091FA01C8
|
||||||
|
:100AD0003091FB012817390751F5F093FB01E093A2
|
||||||
|
:100AE000FA0167C0ED0120E030E0CE17DF0740F4E7
|
||||||
|
:100AF0004A815B819E0141155105F1F0EA01F5CF74
|
||||||
|
:100B0000D383C28340815181840F951FC817D907B1
|
||||||
|
:100B100059F488819981840F951F0296918380836F
|
||||||
|
:100B20008A819B81938382832115310529F4F09377
|
||||||
|
:100B3000FD01E093FC013DC0E901FB83EA8349919B
|
||||||
|
:100B40005991C40FD51FEC17FD0761F48081918185
|
||||||
|
:100B5000840F951F0296E90199838883828193818E
|
||||||
|
:100B60009B838A83E0E0F0E012968D919C9113972D
|
||||||
|
:100B7000009719F0FD01DC01F7CF8D919C91119741
|
||||||
|
:100B80009D012E5F3F4F820F931F2091FA013091FC
|
||||||
|
:100B9000FB012817390769F4309729F41092FD01F9
|
||||||
|
:100BA0001092FC0102C013821282B093FB01A09349
|
||||||
|
:100BB000FA01DF91CF91089581E090E0F8940C94D0
|
||||||
|
:060BC000E105F894FFCFEF
|
||||||
|
:100BC6000000FE0120000000000023018C00BA0096
|
||||||
|
:100BD6007001EB00C900DD000200030004000500FF
|
||||||
|
:100BE60006000700080009000A000B000C000D00B3
|
||||||
|
:080BF6000E000F0010001100B9
|
||||||
|
:00000001FF
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
!<arch>
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
97ed289a32254916cee28d2d2512b6f343406f5d
|
|
@ -0,0 +1,73 @@
|
||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mac",
|
||||||
|
"macFrameworkPath": [],
|
||||||
|
"includePath": [
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/include",
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/src",
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/lib/EasyTransfer",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/cores/arduino",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/variants/HoodLoader2",
|
||||||
|
"/Users/James/.platformio/lib/Adafruit NeoPixel_ID28",
|
||||||
|
"/Users/James/.platformio/lib/Adafruit NeoPixel_ID28@1.3.5",
|
||||||
|
"/Users/James/.platformio/lib/EasyingLib/src",
|
||||||
|
"/Users/James/.platformio/lib/LedControl_ID914/src",
|
||||||
|
"/Users/James/.platformio/lib/TinyWire",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/EEPROM/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/HID/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/SPI/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/SoftwareSerial/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/Wire/src",
|
||||||
|
"/Users/James/.platformio/packages/tool-unity",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"browse": {
|
||||||
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
|
"path": [
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/include",
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/src",
|
||||||
|
"/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/lib/EasyTransfer",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/cores/arduino",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/variants/HoodLoader2",
|
||||||
|
"/Users/James/.platformio/lib/Adafruit NeoPixel_ID28",
|
||||||
|
"/Users/James/.platformio/lib/Adafruit NeoPixel_ID28@1.3.5",
|
||||||
|
"/Users/James/.platformio/lib/EasyingLib/src",
|
||||||
|
"/Users/James/.platformio/lib/LedControl_ID914/src",
|
||||||
|
"/Users/James/.platformio/lib/TinyWire",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/EEPROM/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/HID/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/SPI/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/SoftwareSerial/src",
|
||||||
|
"/Users/James/.platformio/packages/framework-arduino-avr/libraries/Wire/src",
|
||||||
|
"/Users/James/.platformio/packages/tool-unity",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"defines": [
|
||||||
|
"PLATFORMIO=50001",
|
||||||
|
"ARDUINO_ARCH_AVR",
|
||||||
|
"ARDUINO_AVR_HOODLOADER2",
|
||||||
|
"MAGIC_KEY_POS=(RAMEND-1)",
|
||||||
|
"USB_EP_SIZE=16",
|
||||||
|
"F_CPU=16000000L",
|
||||||
|
"ARDUINO_ARCH_AVR",
|
||||||
|
"ARDUINO=10808",
|
||||||
|
"__AVR_ATmega328P__",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"intelliSenseMode": "clang-x64",
|
||||||
|
"cStandard": "c11",
|
||||||
|
"cppStandard": "c++11",
|
||||||
|
"compilerPath": "/Users/James/.platformio/packages/toolchain-atmelavr/bin/avr-gcc",
|
||||||
|
"compilerArgs": [
|
||||||
|
"-mmcu=atmega328p",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"platformio.platformio-ide"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
|
||||||
|
|
||||||
|
// PIO Unified Debugger
|
||||||
|
//
|
||||||
|
// Documentation: https://docs.platformio.org/page/plus/debugging.html
|
||||||
|
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html
|
||||||
|
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "platformio-debug",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PIO Debug",
|
||||||
|
"executable": "/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/.pio/build/HoodLoader2atmega328p/firmware.elf",
|
||||||
|
"toolchainBinDir": "/Users/James/.platformio/packages/toolchain-atmelavr/bin",
|
||||||
|
"preLaunchTask": {
|
||||||
|
"type": "PlatformIO",
|
||||||
|
"task": "Pre-Debug"
|
||||||
|
},
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "platformio-debug",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PIO Debug (skip Pre-Debug)",
|
||||||
|
"executable": "/Volumes/Network/james/Making/Arduino/Cockpit-Switch-Panel/.pio/build/HoodLoader2atmega328p/firmware.elf",
|
||||||
|
"toolchainBinDir": "/Users/James/.platformio/packages/toolchain-atmelavr/bin",
|
||||||
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,55 +0,0 @@
|
||||||
#include <EasyTransfer.h>
|
|
||||||
|
|
||||||
#define BUTTONS 16
|
|
||||||
#define FAUXBUTTONS 5
|
|
||||||
|
|
||||||
const long speedLimit = 10;
|
|
||||||
|
|
||||||
unsigned long lastSend = 0;
|
|
||||||
|
|
||||||
int buttonPins[BUTTONS] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A0, A1, A2, A3 };
|
|
||||||
int analogButtonPin = A4;
|
|
||||||
|
|
||||||
EasyTransfer ET;
|
|
||||||
|
|
||||||
struct SEND_DATA_STRUCTURE{
|
|
||||||
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
|
||||||
int16_t joyx;
|
|
||||||
int16_t joyy;
|
|
||||||
int8_t joyz;
|
|
||||||
int16_t joyxr;
|
|
||||||
int16_t joyyr;
|
|
||||||
int8_t joyzr;
|
|
||||||
uint32_t buttonState;
|
|
||||||
};
|
|
||||||
|
|
||||||
SEND_DATA_STRUCTURE controllerState;
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Serial.begin(2000000);
|
|
||||||
ET.begin(details(controllerState), &Serial);
|
|
||||||
for (int i = 0; i < BUTTONS; i++) { pinMode(buttonPins[i], INPUT_PULLUP); }
|
|
||||||
pinMode(analogButtonPin, INPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t readButtons(){
|
|
||||||
uint32_t buttonStateNow = 0;
|
|
||||||
for (int i=0; i<BUTTONS; i++) {
|
|
||||||
bitWrite(buttonStateNow, i, !digitalRead(buttonPins[i]));
|
|
||||||
}
|
|
||||||
int fauxButton = analogRead(analogButtonPin) / 205;
|
|
||||||
for (int i=0; i<FAUXBUTTONS; i++) {
|
|
||||||
bool buttonPressed = false;
|
|
||||||
fauxButton == i ? buttonPressed = true : buttonPressed = false;
|
|
||||||
bitWrite(buttonStateNow, i + BUTTONS, buttonPressed);
|
|
||||||
}
|
|
||||||
return buttonStateNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
controllerState.buttonState = readButtons();
|
|
||||||
if ((millis() - lastSend) > speedLimit ) {
|
|
||||||
ET.sendData();
|
|
||||||
lastSend = millis();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_HOODLOADER2 -DMAGIC_KEY_POS=(RAMEND-1) -DUSB_EP_SIZE=16",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"hwids": [
|
||||||
|
[
|
||||||
|
"0x2341",
|
||||||
|
"0x484C"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"mcu": "atmega16u2",
|
||||||
|
"variant": "HoodLoader2"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"simba"
|
||||||
|
],
|
||||||
|
"fuses": {
|
||||||
|
"efuse": "0xFC",
|
||||||
|
"hfuse": "0xD8",
|
||||||
|
"lfuse": "0xEF",
|
||||||
|
"lock": "0x0F"
|
||||||
|
},
|
||||||
|
"name": "HoodLoader2 16u2 Uno",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 512,
|
||||||
|
"maximum_size": 12288,
|
||||||
|
"protocol": "avr109",
|
||||||
|
"disable_flushing": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"speed": 57600
|
||||||
|
},
|
||||||
|
"url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-uno",
|
||||||
|
"vendor": "Arduino"
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_AVR_MICRODUINO_CORE",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"hwids": [
|
||||||
|
[
|
||||||
|
"0x2341",
|
||||||
|
"0x484C"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"mcu": "atmega328p",
|
||||||
|
"variant": "standard"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"simba"
|
||||||
|
],
|
||||||
|
"fuses": {
|
||||||
|
"efuse": "0x05",
|
||||||
|
"hfuse": "0xDE",
|
||||||
|
"lfuse": "0xFF",
|
||||||
|
"lock": "0x3F"
|
||||||
|
},
|
||||||
|
"name": "HoodLoader2 328p Uno",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 2048,
|
||||||
|
"maximum_size": 32256,
|
||||||
|
"protocol": "arduino",
|
||||||
|
"disable_flushing": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true,
|
||||||
|
"speed": 115200
|
||||||
|
},
|
||||||
|
"url": "http://www.arduino.org/products/boards/4-arduino-boards/arduino-uno",
|
||||||
|
"vendor": "Arduino"
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
This directory is intended for project header files.
|
||||||
|
|
||||||
|
A header file is a file containing C declarations and macro definitions
|
||||||
|
to be shared between several project source files. You request the use of a
|
||||||
|
header file in your project source file (C, C++, etc) located in `src` folder
|
||||||
|
by including it, with the C preprocessing directive `#include'.
|
||||||
|
|
||||||
|
```src/main.c
|
||||||
|
|
||||||
|
#include "header.h"
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Including a header file produces the same results as copying the header file
|
||||||
|
into each source file that needs it. Such copying would be time-consuming
|
||||||
|
and error-prone. With a header file, the related declarations appear
|
||||||
|
in only one place. If they need to be changed, they can be changed in one
|
||||||
|
place, and programs that include the header file will automatically use the
|
||||||
|
new version when next recompiled. The header file eliminates the labor of
|
||||||
|
finding and changing all the copies as well as the risk that a failure to
|
||||||
|
find one copy will result in inconsistencies within a program.
|
||||||
|
|
||||||
|
In C, the usual convention is to give header files names that end with `.h'.
|
||||||
|
It is most portable to use only letters, digits, dashes, and underscores in
|
||||||
|
header file names, and at most one dot.
|
||||||
|
|
||||||
|
Read more about using header files in official GCC documentation:
|
||||||
|
|
||||||
|
* Include Syntax
|
||||||
|
* Include Operation
|
||||||
|
* Once-Only Headers
|
||||||
|
* Computed Includes
|
||||||
|
|
||||||
|
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
|
@ -0,0 +1,87 @@
|
||||||
|
#include "EasyTransfer.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Captures address and size of struct
|
||||||
|
void EasyTransfer::begin(uint8_t * ptr, uint8_t length, Stream *theStream){
|
||||||
|
address = ptr;
|
||||||
|
size = length;
|
||||||
|
_stream = theStream;
|
||||||
|
|
||||||
|
//dynamic creation of rx parsing buffer in RAM
|
||||||
|
rx_buffer = (uint8_t*) malloc(size+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sends out struct in binary, with header, length info and checksum
|
||||||
|
void EasyTransfer::sendData(){
|
||||||
|
uint8_t CS = size;
|
||||||
|
_stream->write(0x06);
|
||||||
|
_stream->write(0x85);
|
||||||
|
_stream->write(size);
|
||||||
|
for(int i = 0; i<size; i++){
|
||||||
|
CS^=*(address+i);
|
||||||
|
_stream->write(*(address+i));
|
||||||
|
}
|
||||||
|
_stream->write(CS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean EasyTransfer::receiveData(){
|
||||||
|
|
||||||
|
//start off by looking for the header bytes. If they were already found in a previous call, skip it.
|
||||||
|
if(rx_len == 0){
|
||||||
|
//this size check may be redundant due to the size check below, but for now I'll leave it the way it is.
|
||||||
|
if(_stream->available() >= 3){
|
||||||
|
//this will block until a 0x06 is found or buffer size becomes less then 3.
|
||||||
|
while(_stream->read() != 0x06) {
|
||||||
|
//This will trash any preamble junk in the serial buffer
|
||||||
|
//but we need to make sure there is enough in the buffer to process while we trash the rest
|
||||||
|
//if the buffer becomes too empty, we will escape and try again on the next call
|
||||||
|
if(_stream->available() < 3)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_stream->read() == 0x85){
|
||||||
|
rx_len = _stream->read();
|
||||||
|
//make sure the binary structs on both Arduinos are the same size.
|
||||||
|
if(rx_len != size){
|
||||||
|
rx_len = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//we get here if we already found the header bytes, the struct size matched what we know, and now we are byte aligned.
|
||||||
|
if(rx_len != 0){
|
||||||
|
while(_stream->available() && rx_array_inx <= rx_len){
|
||||||
|
rx_buffer[rx_array_inx++] = _stream->read();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rx_len == (rx_array_inx-1)){
|
||||||
|
//seem to have got whole message
|
||||||
|
//last uint8_t is CS
|
||||||
|
calc_CS = rx_len;
|
||||||
|
for (int i = 0; i<rx_len; i++){
|
||||||
|
calc_CS^=rx_buffer[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(calc_CS == rx_buffer[rx_array_inx-1]){//CS good
|
||||||
|
memcpy(address,rx_buffer,size);
|
||||||
|
rx_len = 0;
|
||||||
|
rx_array_inx = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
|
//failed checksum, need to clear this out anyway
|
||||||
|
rx_len = 0;
|
||||||
|
rx_array_inx = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/******************************************************************
|
||||||
|
* EasyTransfer Arduino Library
|
||||||
|
* details and example sketch:
|
||||||
|
* http://www.billporter.info/easytransfer-arduino-library/
|
||||||
|
*
|
||||||
|
* Brought to you by:
|
||||||
|
* Bill Porter
|
||||||
|
* www.billporter.info
|
||||||
|
*
|
||||||
|
* See Readme for other info and version history
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
<http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||||
|
*To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or
|
||||||
|
*send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
|
||||||
|
******************************************************************/
|
||||||
|
#ifndef EasyTransfer_h
|
||||||
|
#define EasyTransfer_h
|
||||||
|
|
||||||
|
|
||||||
|
//make it a little prettier on the front end.
|
||||||
|
#define details(name) (byte*)&name,sizeof(name)
|
||||||
|
|
||||||
|
//Not neccessary, but just in case.
|
||||||
|
#if ARDUINO > 22
|
||||||
|
#include "Arduino.h"
|
||||||
|
#else
|
||||||
|
#include "WProgram.h"
|
||||||
|
#endif
|
||||||
|
#include "Stream.h"
|
||||||
|
//#include <NewSoftSerial.h>
|
||||||
|
//#include <math.h>
|
||||||
|
//#include <stdio.h>
|
||||||
|
//#include <stdint.h>
|
||||||
|
//#include <avr/io.h>
|
||||||
|
|
||||||
|
class EasyTransfer {
|
||||||
|
public:
|
||||||
|
void begin(uint8_t *, uint8_t, Stream *theStream);
|
||||||
|
//void begin(uint8_t *, uint8_t, NewSoftSerial *theSerial);
|
||||||
|
void sendData();
|
||||||
|
boolean receiveData();
|
||||||
|
private:
|
||||||
|
Stream *_stream;
|
||||||
|
//NewSoftSerial *_serial;
|
||||||
|
uint8_t * address; //address of struct
|
||||||
|
uint8_t size; //size of struct
|
||||||
|
uint8_t * rx_buffer; //address for temporary storage and parsing buffer
|
||||||
|
uint8_t rx_array_inx; //index for RX parsing buffer
|
||||||
|
uint8_t rx_len; //RX packet length according to the packet
|
||||||
|
uint8_t calc_CS; //calculated Chacksum
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
|
@ -0,0 +1,61 @@
|
||||||
|
/******************************************************************
|
||||||
|
* EasyTransfer Arduino Library v1.7
|
||||||
|
* details and example sketch:
|
||||||
|
* http://www.billporter.info/easytransfer-arduino-library/
|
||||||
|
*
|
||||||
|
* Brought to you by:
|
||||||
|
* Bill Porter
|
||||||
|
* www.billporter.info
|
||||||
|
*
|
||||||
|
* Lib version history
|
||||||
|
* 1.0 Created
|
||||||
|
* 1.1 Fixed dumb Copy-paste error in header file
|
||||||
|
* Added a keyword file
|
||||||
|
* 1.5 Forked lib into Software and Hardware Serial branches, I don't know a better way
|
||||||
|
* added passing in of Serial port of different types
|
||||||
|
* 1.6 Fixed bug where it wasn't clearing out the buffers if the CheckSum failed,
|
||||||
|
* I'm good at dumb mistakes
|
||||||
|
* 1.7 Fixed a bug where the receive function could block for too long and never process data correctly
|
||||||
|
* Organized the examples to be Arduino IDE compatible
|
||||||
|
* 1.8
|
||||||
|
* Now Arduino 1.0 compatible!
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Limits of the Library
|
||||||
|
* You can change the Serial port,
|
||||||
|
* but the Struct size must not pass 255 bytes
|
||||||
|
*
|
||||||
|
* The protcol is as follows:
|
||||||
|
* Header(0x06,0x85),SizeofPayload,Payload,Checksum
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
<http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||||
|
*To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or
|
||||||
|
*send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
|
||||||
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
********************To Install*************************************
|
||||||
|
|
||||||
|
To install, unzip and place 'EasyTransfer' folder into your 'C:\Users\{user name}\Documents\Arduino\libraries' folder or '{Arduino IDE path}\hardware\libraries" or {Arduino IDE path}\libraries" directory.
|
||||||
|
|
||||||
|
Restart the Arduino IDE, look for the Library under "Sketch" -> "Import Library". You can also try the examples by finding them
|
||||||
|
under "File" -> "Examples" -> "EasyTransfer".
|
||||||
|
|
||||||
|
All uses of the library are in the example sketchs.
|
||||||
|
|
||||||
|
|
||||||
|
*******************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
Library now has two versions, one for regular hardware Serial, one for use with the NewSoftSerial library
|
||||||
|
making any Arduino pin capable of transfering data back and forth easily.
|
||||||
|
|
||||||
|
See the examples to find out how to use the library.
|
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
|
@ -0,0 +1,84 @@
|
||||||
|
/*This is an example of the EasyTransfer Library 2way communications.
|
||||||
|
|
||||||
|
The sketch is for the Arduino with a potentiometer attached to analog pin 0.
|
||||||
|
|
||||||
|
This other Arduino has the servo attached to pin 9.
|
||||||
|
Both have a putton attached to pin 12 and output a status using the LED on pin 13.
|
||||||
|
|
||||||
|
The idea is each arduino will read the status of the button attached to it, and send it
|
||||||
|
to the other Arduino, which will toggle it's LED based on the others button. The button
|
||||||
|
should connect pin 12 to ground when pushed.
|
||||||
|
|
||||||
|
And the Arduino with the potentiometer will send it's value to the one with the servo.
|
||||||
|
The servo will move to the position based on the potentiometer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <EasyTransfer.h>
|
||||||
|
|
||||||
|
//create two objects
|
||||||
|
EasyTransfer ETin, ETout;
|
||||||
|
|
||||||
|
|
||||||
|
struct RECEIVE_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to receive
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t buttonstate;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SEND_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to receive
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t buttonstate;
|
||||||
|
int16_t servoval;
|
||||||
|
};
|
||||||
|
|
||||||
|
//give a name to the group of data
|
||||||
|
RECEIVE_DATA_STRUCTURE rxdata;
|
||||||
|
SEND_DATA_STRUCTURE txdata;
|
||||||
|
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(9600);
|
||||||
|
//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
|
||||||
|
ETin.begin(details(rxdata), &Serial);
|
||||||
|
ETout.begin(details(txdata), &Serial);
|
||||||
|
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
//enable pull-up
|
||||||
|
pinMode(12, INPUT_PULLUP);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
|
||||||
|
//first, lets read our potentiometer and button and store it in our data structure
|
||||||
|
txdata.servoval = analogRead(0);
|
||||||
|
|
||||||
|
if(!digitalRead(12))
|
||||||
|
txdata.buttonstate = HIGH;
|
||||||
|
else
|
||||||
|
txdata.buttonstate = LOW;
|
||||||
|
|
||||||
|
//then we will go ahead and send that data out
|
||||||
|
ETout.sendData();
|
||||||
|
|
||||||
|
//there's a loop here so that we run the recieve function more often then the
|
||||||
|
//transmit function. This is important due to the slight differences in
|
||||||
|
//the clock speed of different Arduinos. If we didn't do this, messages
|
||||||
|
//would build up in the buffer and appear to cause a delay.
|
||||||
|
for(int i=0; i<5; i++){
|
||||||
|
//remember, you could use an if() here to check for new data, this time it's not needed.
|
||||||
|
ETin.receiveData();
|
||||||
|
|
||||||
|
//set our LED on or off based on what we received from the other Arduino
|
||||||
|
digitalWrite(13, rxdata.buttonstate);
|
||||||
|
|
||||||
|
//delay
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delay for good measure
|
||||||
|
delay(10);
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*This is an example of the EasyTransfer Library 2way communications.
|
||||||
|
|
||||||
|
This sketch is for the Arduino with the servo attached to pin 9.
|
||||||
|
|
||||||
|
The other Arduino has a potentiometer attached to analog pin 0.
|
||||||
|
Both have a putton attached to pin 12 and output a status using the LED on pin 13.
|
||||||
|
|
||||||
|
The idea is each arduino will read the status of the button attached to it, and send it
|
||||||
|
to the other Arduino, which will toggle it's LED based on the others button. The button
|
||||||
|
should connect pin 12 to ground when pushed.
|
||||||
|
|
||||||
|
And the Arduino with the potentiometer will send it's value to the one with the servo.
|
||||||
|
The servo will move to the position based on the potentiometer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Servo.h>
|
||||||
|
#include <EasyTransfer.h>
|
||||||
|
|
||||||
|
//create two objects
|
||||||
|
EasyTransfer ETin, ETout;
|
||||||
|
//create servo
|
||||||
|
Servo myservo;
|
||||||
|
|
||||||
|
struct RECEIVE_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to receive
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t buttonstate;
|
||||||
|
int16_t servoval;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SEND_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to receive
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t buttonstate;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//give a name to the group of data
|
||||||
|
RECEIVE_DATA_STRUCTURE rxdata;
|
||||||
|
SEND_DATA_STRUCTURE txdata;
|
||||||
|
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(9600);
|
||||||
|
//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
|
||||||
|
ETin.begin(details(rxdata), &Serial);
|
||||||
|
ETout.begin(details(txdata), &Serial);
|
||||||
|
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
//enable pull-up
|
||||||
|
pinMode(12, INPUT_PULLUP);
|
||||||
|
|
||||||
|
myservo.attach(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
|
||||||
|
//first, lets read our button and store it in our data structure
|
||||||
|
if(!digitalRead(12))
|
||||||
|
txdata.buttonstate = HIGH;
|
||||||
|
else
|
||||||
|
txdata.buttonstate = LOW;
|
||||||
|
|
||||||
|
//then we will go ahead and send that data out
|
||||||
|
ETout.sendData();
|
||||||
|
|
||||||
|
//there's a loop here so that we run the recieve function more often then the
|
||||||
|
//transmit function. This is important due to the slight differences in
|
||||||
|
//the clock speed of different Arduinos. If we didn't do this, messages
|
||||||
|
//would build up in the buffer and appear to cause a delay.
|
||||||
|
|
||||||
|
for(int i=0; i<5; i++){
|
||||||
|
//remember, you could use an if() here to check for new data, this time it's not needed.
|
||||||
|
ETin.receiveData();
|
||||||
|
|
||||||
|
//set our LED on or off based on what we received from the other Arduino
|
||||||
|
digitalWrite(13, rxdata.buttonstate);
|
||||||
|
|
||||||
|
//set our servo position based on what we received from the other Arduino
|
||||||
|
//we will also map the ADC value to a servo value
|
||||||
|
myservo.write(map(rxdata.servoval, 0, 1023, 0, 179));
|
||||||
|
|
||||||
|
//delay
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delay for good measure
|
||||||
|
delay(10);
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
#include <EasyTransfer.h>
|
||||||
|
|
||||||
|
//create object
|
||||||
|
EasyTransfer ET;
|
||||||
|
|
||||||
|
struct RECEIVE_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to receive
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t blinks;
|
||||||
|
int16_t pause;
|
||||||
|
};
|
||||||
|
|
||||||
|
//give a name to the group of data
|
||||||
|
RECEIVE_DATA_STRUCTURE mydata;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(9600);
|
||||||
|
//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
|
||||||
|
ET.begin(details(mydata), &Serial);
|
||||||
|
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
//check and see if a data packet has come in.
|
||||||
|
if(ET.receiveData()){
|
||||||
|
//this is how you access the variables. [name of the group].[variable name]
|
||||||
|
//since we have data, we will blink it out.
|
||||||
|
for(int i = mydata.blinks; i>0; i--){
|
||||||
|
digitalWrite(13, HIGH);
|
||||||
|
delay(mydata.pause * 100);
|
||||||
|
digitalWrite(13, LOW);
|
||||||
|
delay(mydata.pause * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//you should make this delay shorter then your transmit delay or else messages could be lost
|
||||||
|
delay(250);
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
#include <EasyTransfer.h>
|
||||||
|
|
||||||
|
//create object
|
||||||
|
EasyTransfer ET;
|
||||||
|
|
||||||
|
struct SEND_DATA_STRUCTURE{
|
||||||
|
//put your variable definitions here for the data you want to send
|
||||||
|
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
|
||||||
|
int16_t blinks;
|
||||||
|
int16_t pause;
|
||||||
|
};
|
||||||
|
|
||||||
|
//give a name to the group of data
|
||||||
|
SEND_DATA_STRUCTURE mydata;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
Serial.begin(9600);
|
||||||
|
//start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
|
||||||
|
ET.begin(details(mydata), &Serial);
|
||||||
|
|
||||||
|
pinMode(13, OUTPUT);
|
||||||
|
|
||||||
|
randomSeed(analogRead(0));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
//this is how you access the variables. [name of the group].[variable name]
|
||||||
|
mydata.blinks = random(5);
|
||||||
|
mydata.pause = random(5);
|
||||||
|
//send the data
|
||||||
|
ET.sendData();
|
||||||
|
|
||||||
|
//Just for fun, we will blink it out too
|
||||||
|
for(int i = mydata.blinks; i>0; i--){
|
||||||
|
digitalWrite(13, HIGH);
|
||||||
|
delay(mydata.pause * 100);
|
||||||
|
digitalWrite(13, LOW);
|
||||||
|
delay(mydata.pause * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(5000);
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#######################################
|
||||||
|
# Syntax Coloring Map EasyTransfer
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Datatypes (KEYWORD1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
EasyTransfer KEYWORD1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Methods and Functions (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
sendData KEYWORD2
|
||||||
|
receiveData KEYWORD2
|
||||||
|
begin KEYWORD2
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Constants (LITERAL1)
|
||||||
|
#######################################
|
||||||
|
details LITERAL1
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
This directory is intended for project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link into executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in a an own separate directory
|
||||||
|
("lib/your_library_name/[here are source files]").
|
||||||
|
|
||||||
|
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||||
|
| |
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |
|
||||||
|
| |- README --> THIS FILE
|
||||||
|
|
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
and a contents of `src/main.c`:
|
||||||
|
```
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
PlatformIO Library Dependency Finder will find automatically dependent
|
||||||
|
libraries scanning project source files.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- https://docs.platformio.org/page/librarymanager/ldf.html
|
|
@ -0,0 +1,14 @@
|
||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:HoodLoader2atmega328p]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = HoodLoader2atmega328p
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 5507d2003993a0c1101494baa118944116857478
|
Loading…
Reference in New Issue