diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341M64.sys b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341M64.sys new file mode 100644 index 0000000000000000000000000000000000000000..33ab5ce3d4a6767ea4d7aa11f042a727e8fe3041 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341M64.sys differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTS.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTS.DLL new file mode 100644 index 0000000000000000000000000000000000000000..0ce942305a4008f2891dd050101e2fb3e3270f6c Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTS.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTSA64.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTSA64.DLL new file mode 100644 index 0000000000000000000000000000000000000000..efaa94f168c6e2af47db19885b48fb522a711b8f Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PORTSA64.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PT.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PT.DLL new file mode 100644 index 0000000000000000000000000000000000000000..e3113c560200f55fa1d3839b6cd9403daf7e5d26 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PT.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PTA64.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PTA64.DLL new file mode 100644 index 0000000000000000000000000000000000000000..9d17d7d160c5f026ebd76e57caa352ca2ca488bb Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341PTA64.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S64.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S64.SYS new file mode 100644 index 0000000000000000000000000000000000000000..3784a49457d671c206330e3341c91ec41566d19c Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S64.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S98.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S98.SYS new file mode 100644 index 0000000000000000000000000000000000000000..261f0844226d70016230718183a0349ff9c2b432 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341S98.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.CAT b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.CAT new file mode 100644 index 0000000000000000000000000000000000000000..b13745e17eb77a1119cdc1c364c3f0b61b4446aa Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.CAT differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.INF b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.INF new file mode 100644 index 0000000000000000000000000000000000000000..3da3a76d3afa30e1ef7bfed2dbcd059e37b49839 --- /dev/null +++ b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.INF @@ -0,0 +1,282 @@ +; CH341SER.INF +; Driver for CH340/CH341 (USB=>SERIAL chip) V3.7 +; WDM&VXD for Windows 98/Me/2000/XP/Vista/7/8/8.1/10/11/SERVER 2003/2008/2012/2016/2019/2022 +; Copyright (C) W.ch 2001-2022 +; + +[Version] +Signature = "$Chicago$" +Class = Ports +ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318} +Provider = %WinChipHead% +DriverVer = 01/18/2022, 3.7.2022.01 +CatalogFile =CH341SER.CAT + + +[ControlFlags] +ExcludeFromSelect = USB\VID_1A86&PID_7523 +ExcludeFromSelect = USB\VID_1A86&PID_5523 +ExcludeFromSelect = USB\VID_1A86&PID_7522 +ExcludeFromSelect = USB\VID_1A86&PID_E523 +ExcludeFromSelect = USB\VID_4348&PID_5523 +ExcludeFromSelect = USB\VID_4348&PID_5523&REV_0250 +ExcludeFromSelect = USBSERPORT\SER5523 +ExcludeFromSelect = CH341PORT\SER5523 + +[Manufacturer] +%WinChipHead% = WinChipHead,NT,NTamd64,NTia64,NTARM64 + +[WinChipHead] +%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523&REV_0250 +%CH341S98.DeviceDesc% = CH341S98_Install, USBSERPORT\SER5523 +%CH341S98.DeviceDesc% = CH341S98_Install, CH341PORT\SER5523 + +[WinChipHead.NT] +%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTamd64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTia64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTARM64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_4348&PID_5523&REV_0250 + +[CH341SER_Install] +DelFiles = CH341S98.DelFiles.SYS +CopyFiles = CH341SER.CopyFiles.SYS, CH341SER.CopyFiles.DLL +AddReg = CH341SER.9X.AddReg, CH341SER.AddReg + +[CH341SER_Install.NT] +CopyFiles = CH341SER.NT.CopyFiles.SYS, CH341SER.CopyFiles.DLL +AddReg = CH341SER.NT.AddReg, CH341SER.AddReg + +[CH341SER_Install.NT.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTamd64] +CopyFiles = CH341SER.NT.CopyFiles.SYSA64, CH341SER.CopyFiles.DLLA64, CH341SER.CopyFiles.WOWDLL +AddReg = CH341SER.NTAMD64.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTamd64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTia64] +CopyFiles = CH341SER.NT.CopyFiles.SYSI64,CH341SER.CopyFiles.DLLA64 +AddReg = CH341SER.NT.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTia64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTARM64] +CopyFiles = CH341SER.NT.CopyFiles.SYSM64,CH341SER.CopyFiles.DLLA64, CH341SER.CopyFiles.WOWDLL +AddReg = CH341SER.NTARM64.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTARM64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341S98_Install] +DelFiles = CH341S98.DelFiles.SYS +CopyFiles = CH341S98.CopyFiles.VXD, CH341SER.CopyFiles.SYS +AddReg = CH341S98.9X.AddReg, CH341S98.AddReg + +;[CH341S98_Install.NT] + +[CH341S98.DelFiles.SYS] +CH341S98.SYS, , , 1 + +[CH341SER.CopyFiles.SYS] +CH341S98.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYS] +CH341SER.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSA64] +CH341S64.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSI64] +;CH341I64.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSM64] +CH341M64.SYS, , , 2 + +[CH341S98.CopyFiles.VXD] +CH341SER.VXD, , , 2 + +[CH341SER.CopyFiles.DLL] +CH341PT.DLL, , , 2 +CH341PORTS.DLL, , , 2 + +[CH341SER.CopyFiles.DLLA64] +CH341PTA64.DLL, , , 2 +CH341PORTSA64.DLL, , , 2 + +[CH341SER.CopyFiles.WOWDLL] +CH341PT.DLL, , , 2 +;��װDLL�ǿ�ѡ��,DLL��������ʶ��CH341�˿ںͼ���CH341�˿ڵIJ���¼� + +[CH341SER.9X.AddReg] +HKR, , DevLoader, , *NTKERN +HKR, , NTMPDriver, , CH341S98.SYS + +[CH341SER.NT.AddReg] +HKR,,EnumPropPages32,,"CH341PORTS.dll,SerialPortPropPageProvider" + +[CH341SER.NTAMD64.AddReg] +HKR,,EnumPropPages32,,"CH341PORTSA64.dll,SerialPortPropPageProvider" + +[CH341SER.NTARM64.AddReg] +HKR,,EnumPropPages32,,"CH341PORTSA64.dll,SerialPortPropPageProvider" + +[CH341SER.NT.HW.AddReg] +;HKR,,"EnableBRA",0x00010001,1 +;HKR,,"BRAVal",0x00010001,1 +;�����������ڲ����ʵ����������������ɽ��������зֺ�ȥ�� +;HKR,,"UpperFilters",0x00010000,"serenum" +;������������ö�ٽ��ڴ��ڵļ��弴���豸,����ʱ������DTR��RTS�ź�,�����Ҫö��,�뽫�������еķֺ�ȥ�� + +[CH341S98.9X.AddReg] +HKR, , DevLoader, , *vcomm +HKR, , PortDriver, , CH341SER.VXD +HKR, , Contention, , *vcd +HKR, , ConfigDialog, , serialui.dll +HKR, , DCB, 3, 1C,00,00,00, 80,25,00,00, 11,00,00,00, 00,00,0A,00, 0A,00,08,00, 00,11,13,00, 00,00,00,00 +HKR, , PortSubClass, 1, 01 +HKR, , EnumPropPages, , "serialui.dll,EnumPropPages" +;HKR, , Enumerator, , serenum.vxd +;������������ö�ٽ��ڴ��ڵļ��弴���豸,����ʱ������DTR��RTS�ź�,�����Ҫö��,�뽫�������еķֺ�ȥ�� + +[CH341SER.AddReg] +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, WDM, 0x00010001, 0x00000034 +HKLM, SOFTWARE\WinChipHead\IC\CH341PORT, DLL, 0x00010001, 0x00000010 +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, Function, , "USB=>Serial" +;HKLM, SYSTEM\CurrentControlSet\Services\CH341SER, UserRemoval, 0x00010001, 0x00000001 +;��������������ϵͳ��������ʾ����ȫɾ��USBתSERIALӲ���豸���������û��ֹ�ɾ��Ӳ�� + +[CH341S98.AddReg] +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, VXD, 0x00010001, 0x00000023 + +[CH341SER_Install.NT.Services] +AddService = CH341SER, 2, CH341SER.Service +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTamd64.Services] +AddService = CH341SER_A64, 2, CH341SER.ServiceA64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTia64.Services] +AddService = CH341SER_I64, 2, CH341SER.ServiceI64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTARM64.Services] +AddService = CH341SER_M64, 2, CH341SER.ServiceM64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER.Service] +DisplayName = "CH341SER" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341SER.SYS + +[CH341SER.ServiceA64] +DisplayName = "CH341SER_A64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341S64.SYS + +[CH341SER.ServiceI64] +DisplayName = "CH341SER_I64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341I64.SYS + +[CH341SER.ServiceM64] +DisplayName = "CH341SER_M64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341M64.SYS + +[Serenum_Service_Inst] +DisplayName = "SerEnum" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\serenum.sys +LoadOrderGroup = PNP Filter + +[DestinationDirs] +DefaultDestDir = 10, System32\Drivers +CH341S98.DelFiles.SYS = 11 +CH341SER.CopyFiles.SYS = 10, System32\Drivers +CH341SER.NT.CopyFiles.SYS = 10, System32\Drivers +CH341S98.CopyFiles.VXD = 11 +CH341SER.CopyFiles.DLL = 11 +CH341SER.CopyFiles.DLLA64 = 11 +CH341SER.CopyFiles.WOWDLL = 10,SysWOW64 +CH341SER.NT.CopyFiles.SYSA64 = 10, System32\Drivers +CH341SER.NT.CopyFiles.SYSM64 = 10, System32\Drivers +;CH341SER.NT.CopyFiles.SYSI64 = 10, System32\Drivers + +[SourceDisksFiles] +CH341M64.SYS = 1 +CH341PT.DLL = 1 +CH341PTA64.DLL= 1 +CH341SER.SYS = 1 +CH341S98.SYS = 1 +CH341SER.VXD = 1 +CH341S64.SYS = 1 +CH341PORTS.DLL = 1 +CH341PORTSA64.DLL = 1 +;CH341I64.SYS = 1 + +[SourceDisksNames] +1 = %DISK_NAME%, , , + +[SourceDisksNames.amd64] +1 = %DISK_NAME%, , , + +[SourceDisksNames.ia64] +1 = %DISK_NAME%, , , + +[SourceDisksNames.arm64] +1 = %DISK_NAME%, , , + +[Strings] +WinChipHead = "wch.cn" +CH341SER.DeviceDesc = "USB-SERIAL CH341" +CH341S98.DeviceDesc = "USB-SERIAL CH341" +CH340SER.DeviceDesc = "USB-SERIAL CH340" +CH341ASER.DeviceDesc = "USB-SERIAL CH341A" +CH340KSER.DeviceDesc = "USB-SERIAL CH340K" +CH330SER.DeviceDesc = "USB-SERIAL CH330" +DISK_NAME = "CH341 Serial Installation Disk" diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.SYS new file mode 100644 index 0000000000000000000000000000000000000000..a4c846c89272555409034bb91cd0ee11a4fc796d Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.VXD b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.VXD new file mode 100644 index 0000000000000000000000000000000000000000..1c04d3dfafbdc94db4a03e4163022449f1ddf21f Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/CH341SER.VXD differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/DRVSETUP64/DRVSETUP64.exe b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/DRVSETUP64/DRVSETUP64.exe new file mode 100644 index 0000000000000000000000000000000000000000..826fdc342edac270e6e7d2eabd803b15fa3645f4 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/DRVSETUP64/DRVSETUP64.exe differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/SETUP.EXE b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/SETUP.EXE new file mode 100644 index 0000000000000000000000000000000000000000..bf142f96c4ca7e3ba3a1528de304da231b074d15 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/SETUP.EXE differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341M64.sys b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341M64.sys new file mode 100644 index 0000000000000000000000000000000000000000..cf588a3023f27e5634c61c3617ee7e419374146f Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341M64.sys differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTS.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTS.DLL new file mode 100644 index 0000000000000000000000000000000000000000..d040b9c9bc84e99ea78c9f1b9791c5eecb37cb57 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTS.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTSA64.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTSA64.DLL new file mode 100644 index 0000000000000000000000000000000000000000..785cd64231c6752a0963d5c6f1655ed42cef5505 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PORTSA64.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PT.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PT.DLL new file mode 100644 index 0000000000000000000000000000000000000000..37cadfc6b084e984ace1fc87a61f51da7a4d8982 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PT.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PTA64.DLL b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PTA64.DLL new file mode 100644 index 0000000000000000000000000000000000000000..c5c69afbe150b7cc6327185bbdc8845417de35d2 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341PTA64.DLL differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S64.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S64.SYS new file mode 100644 index 0000000000000000000000000000000000000000..440e9e5cc10ef257fc3ad53036f662e11a51fa28 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S64.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S98.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S98.SYS new file mode 100644 index 0000000000000000000000000000000000000000..c2939dde68294e972cbef2f583bafe912dae877e Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341S98.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.CAT b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.CAT new file mode 100644 index 0000000000000000000000000000000000000000..a79e9f5cfd66af8e128d38ba158febe6ab19b067 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.CAT differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.INF b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.INF new file mode 100644 index 0000000000000000000000000000000000000000..3da3a76d3afa30e1ef7bfed2dbcd059e37b49839 --- /dev/null +++ b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.INF @@ -0,0 +1,282 @@ +; CH341SER.INF +; Driver for CH340/CH341 (USB=>SERIAL chip) V3.7 +; WDM&VXD for Windows 98/Me/2000/XP/Vista/7/8/8.1/10/11/SERVER 2003/2008/2012/2016/2019/2022 +; Copyright (C) W.ch 2001-2022 +; + +[Version] +Signature = "$Chicago$" +Class = Ports +ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318} +Provider = %WinChipHead% +DriverVer = 01/18/2022, 3.7.2022.01 +CatalogFile =CH341SER.CAT + + +[ControlFlags] +ExcludeFromSelect = USB\VID_1A86&PID_7523 +ExcludeFromSelect = USB\VID_1A86&PID_5523 +ExcludeFromSelect = USB\VID_1A86&PID_7522 +ExcludeFromSelect = USB\VID_1A86&PID_E523 +ExcludeFromSelect = USB\VID_4348&PID_5523 +ExcludeFromSelect = USB\VID_4348&PID_5523&REV_0250 +ExcludeFromSelect = USBSERPORT\SER5523 +ExcludeFromSelect = CH341PORT\SER5523 + +[Manufacturer] +%WinChipHead% = WinChipHead,NT,NTamd64,NTia64,NTARM64 + +[WinChipHead] +%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Install, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Install, USB\VID_4348&PID_5523&REV_0250 +%CH341S98.DeviceDesc% = CH341S98_Install, USBSERPORT\SER5523 +%CH341S98.DeviceDesc% = CH341S98_Install, CH341PORT\SER5523 + +[WinChipHead.NT] +%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Install.NT, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTamd64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTamd64, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTia64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTia64, USB\VID_4348&PID_5523&REV_0250 + +[WinChipHead.NTARM64] +%CH340SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_7523 +%CH341ASER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_5523 +%CH340KSER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_7522 +%CH330SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_1A86&PID_E523 +%CH341SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_4348&PID_5523 +%CH340SER.DeviceDesc% = CH341SER_Inst.NTARM64, USB\VID_4348&PID_5523&REV_0250 + +[CH341SER_Install] +DelFiles = CH341S98.DelFiles.SYS +CopyFiles = CH341SER.CopyFiles.SYS, CH341SER.CopyFiles.DLL +AddReg = CH341SER.9X.AddReg, CH341SER.AddReg + +[CH341SER_Install.NT] +CopyFiles = CH341SER.NT.CopyFiles.SYS, CH341SER.CopyFiles.DLL +AddReg = CH341SER.NT.AddReg, CH341SER.AddReg + +[CH341SER_Install.NT.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTamd64] +CopyFiles = CH341SER.NT.CopyFiles.SYSA64, CH341SER.CopyFiles.DLLA64, CH341SER.CopyFiles.WOWDLL +AddReg = CH341SER.NTAMD64.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTamd64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTia64] +CopyFiles = CH341SER.NT.CopyFiles.SYSI64,CH341SER.CopyFiles.DLLA64 +AddReg = CH341SER.NT.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTia64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341SER_Inst.NTARM64] +CopyFiles = CH341SER.NT.CopyFiles.SYSM64,CH341SER.CopyFiles.DLLA64, CH341SER.CopyFiles.WOWDLL +AddReg = CH341SER.NTARM64.AddReg, CH341SER.AddReg + +[CH341SER_Inst.NTARM64.HW] +AddReg = CH341SER.NT.HW.AddReg + +[CH341S98_Install] +DelFiles = CH341S98.DelFiles.SYS +CopyFiles = CH341S98.CopyFiles.VXD, CH341SER.CopyFiles.SYS +AddReg = CH341S98.9X.AddReg, CH341S98.AddReg + +;[CH341S98_Install.NT] + +[CH341S98.DelFiles.SYS] +CH341S98.SYS, , , 1 + +[CH341SER.CopyFiles.SYS] +CH341S98.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYS] +CH341SER.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSA64] +CH341S64.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSI64] +;CH341I64.SYS, , , 2 + +[CH341SER.NT.CopyFiles.SYSM64] +CH341M64.SYS, , , 2 + +[CH341S98.CopyFiles.VXD] +CH341SER.VXD, , , 2 + +[CH341SER.CopyFiles.DLL] +CH341PT.DLL, , , 2 +CH341PORTS.DLL, , , 2 + +[CH341SER.CopyFiles.DLLA64] +CH341PTA64.DLL, , , 2 +CH341PORTSA64.DLL, , , 2 + +[CH341SER.CopyFiles.WOWDLL] +CH341PT.DLL, , , 2 +;��װDLL�ǿ�ѡ��,DLL��������ʶ��CH341�˿ںͼ���CH341�˿ڵIJ���¼� + +[CH341SER.9X.AddReg] +HKR, , DevLoader, , *NTKERN +HKR, , NTMPDriver, , CH341S98.SYS + +[CH341SER.NT.AddReg] +HKR,,EnumPropPages32,,"CH341PORTS.dll,SerialPortPropPageProvider" + +[CH341SER.NTAMD64.AddReg] +HKR,,EnumPropPages32,,"CH341PORTSA64.dll,SerialPortPropPageProvider" + +[CH341SER.NTARM64.AddReg] +HKR,,EnumPropPages32,,"CH341PORTSA64.dll,SerialPortPropPageProvider" + +[CH341SER.NT.HW.AddReg] +;HKR,,"EnableBRA",0x00010001,1 +;HKR,,"BRAVal",0x00010001,1 +;�����������ڲ����ʵ����������������ɽ��������зֺ�ȥ�� +;HKR,,"UpperFilters",0x00010000,"serenum" +;������������ö�ٽ��ڴ��ڵļ��弴���豸,����ʱ������DTR��RTS�ź�,�����Ҫö��,�뽫�������еķֺ�ȥ�� + +[CH341S98.9X.AddReg] +HKR, , DevLoader, , *vcomm +HKR, , PortDriver, , CH341SER.VXD +HKR, , Contention, , *vcd +HKR, , ConfigDialog, , serialui.dll +HKR, , DCB, 3, 1C,00,00,00, 80,25,00,00, 11,00,00,00, 00,00,0A,00, 0A,00,08,00, 00,11,13,00, 00,00,00,00 +HKR, , PortSubClass, 1, 01 +HKR, , EnumPropPages, , "serialui.dll,EnumPropPages" +;HKR, , Enumerator, , serenum.vxd +;������������ö�ٽ��ڴ��ڵļ��弴���豸,����ʱ������DTR��RTS�ź�,�����Ҫö��,�뽫�������еķֺ�ȥ�� + +[CH341SER.AddReg] +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, WDM, 0x00010001, 0x00000034 +HKLM, SOFTWARE\WinChipHead\IC\CH341PORT, DLL, 0x00010001, 0x00000010 +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, Function, , "USB=>Serial" +;HKLM, SYSTEM\CurrentControlSet\Services\CH341SER, UserRemoval, 0x00010001, 0x00000001 +;��������������ϵͳ��������ʾ����ȫɾ��USBתSERIALӲ���豸���������û��ֹ�ɾ��Ӳ�� + +[CH341S98.AddReg] +HKLM, SOFTWARE\WinChipHead\IC\CH341SER, VXD, 0x00010001, 0x00000023 + +[CH341SER_Install.NT.Services] +AddService = CH341SER, 2, CH341SER.Service +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTamd64.Services] +AddService = CH341SER_A64, 2, CH341SER.ServiceA64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTia64.Services] +AddService = CH341SER_I64, 2, CH341SER.ServiceI64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER_Inst.NTARM64.Services] +AddService = CH341SER_M64, 2, CH341SER.ServiceM64 +;AddService = Serenum, , Serenum_Service_Inst + +[CH341SER.Service] +DisplayName = "CH341SER" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341SER.SYS + +[CH341SER.ServiceA64] +DisplayName = "CH341SER_A64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341S64.SYS + +[CH341SER.ServiceI64] +DisplayName = "CH341SER_I64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341I64.SYS + +[CH341SER.ServiceM64] +DisplayName = "CH341SER_M64" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %10%\System32\Drivers\CH341M64.SYS + +[Serenum_Service_Inst] +DisplayName = "SerEnum" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\serenum.sys +LoadOrderGroup = PNP Filter + +[DestinationDirs] +DefaultDestDir = 10, System32\Drivers +CH341S98.DelFiles.SYS = 11 +CH341SER.CopyFiles.SYS = 10, System32\Drivers +CH341SER.NT.CopyFiles.SYS = 10, System32\Drivers +CH341S98.CopyFiles.VXD = 11 +CH341SER.CopyFiles.DLL = 11 +CH341SER.CopyFiles.DLLA64 = 11 +CH341SER.CopyFiles.WOWDLL = 10,SysWOW64 +CH341SER.NT.CopyFiles.SYSA64 = 10, System32\Drivers +CH341SER.NT.CopyFiles.SYSM64 = 10, System32\Drivers +;CH341SER.NT.CopyFiles.SYSI64 = 10, System32\Drivers + +[SourceDisksFiles] +CH341M64.SYS = 1 +CH341PT.DLL = 1 +CH341PTA64.DLL= 1 +CH341SER.SYS = 1 +CH341S98.SYS = 1 +CH341SER.VXD = 1 +CH341S64.SYS = 1 +CH341PORTS.DLL = 1 +CH341PORTSA64.DLL = 1 +;CH341I64.SYS = 1 + +[SourceDisksNames] +1 = %DISK_NAME%, , , + +[SourceDisksNames.amd64] +1 = %DISK_NAME%, , , + +[SourceDisksNames.ia64] +1 = %DISK_NAME%, , , + +[SourceDisksNames.arm64] +1 = %DISK_NAME%, , , + +[Strings] +WinChipHead = "wch.cn" +CH341SER.DeviceDesc = "USB-SERIAL CH341" +CH341S98.DeviceDesc = "USB-SERIAL CH341" +CH340SER.DeviceDesc = "USB-SERIAL CH340" +CH341ASER.DeviceDesc = "USB-SERIAL CH341A" +CH340KSER.DeviceDesc = "USB-SERIAL CH340K" +CH330SER.DeviceDesc = "USB-SERIAL CH330" +DISK_NAME = "CH341 Serial Installation Disk" diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.SYS b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.SYS new file mode 100644 index 0000000000000000000000000000000000000000..75c3d073f04b6b08f063eeaca8019144047250d6 Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.SYS differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.VXD b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.VXD new file mode 100644 index 0000000000000000000000000000000000000000..1c04d3dfafbdc94db4a03e4163022449f1ddf21f Binary files /dev/null and b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/CH341SER/WIN 1X/CH341SER.VXD differ diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/Code_Dongle_FASTbot.ino b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/Code_Dongle_FASTbot.ino new file mode 100644 index 0000000000000000000000000000000000000000..e9227eb858e3ee9672492e270e00b28b94ee64a1 --- /dev/null +++ b/Documentation/Pre-projet/Custom Dongle/Arduino code/Code_Dongle_FASTbot/Code_Dongle_FASTbot.ino @@ -0,0 +1,148 @@ +/* + See documentation at https://nRF24.github.io/RF24 + See License information at root directory of this library + Author: Brendan Doherty (2bndy5) +*/ + +/** + A simple example of sending data from 1 nRF24L01 transceiver to another. + + This example was written to be used on 2 devices acting as "nodes". + Use the Serial Monitor to change each node's behavior. +*/ +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + + +RF24 radio( 9,8); + +uint8_t address[][6] = { "1Node", "2Node" }; + +bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +float payload[3] = {0.0, 0.0, 0.0}; + +//#define DEBUG + +void setup() { + + Serial.begin(9600); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + +#ifdef DEBUG +Serial.println("Dongle Par FastBot"); +#endif + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + + //radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + radio.setDataRate(RF24_250KBPS); + + radio.setPayloadSize(sizeof(payload)); + + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + radio.startListening(); + + Serial.println("angle commande output"); // réglage pid + +} // setup + +unsigned long Timeout_time = 200; +unsigned long Timeout = 0; + +bool Ping = true; + +void loop() { + + // Il faut faire un ping pong le dongle possède un timer de reset le dongle envoie les trois valeurs et l'autre renvoie + + if (Serial.available()>0) { + + int space = 0; + Serial.print("Données reçu"); + while (Serial.available()>0 && space < 3) { + payload[space] = Serial.parseFloat(); + #ifdef DEBUG + Serial.print(payload[space]); + Serial.print(':'); + #endif + space++; + + } +// Serial.print('\n'); + + while (Serial.available()) + { + Serial.read(); + } + + + } +// + unsigned long actualTime = millis(); + + if (((actualTime - Timeout) > Timeout_time) & (Ping == false) ) + { +// Serial.println("Timeout reach"); + Ping = true; + } +// + if (Ping == true) + { + Ping = false; + + Timeout = millis(); + + radio.stopListening(); + + bool report =radio.write(&payload, sizeof(payload)); + #ifdef DEBUG + if (report) { + Serial.print(F("Transmission successful! ")); // payload was delivered + } else { + Serial.println(F("Transmission failed or timed out")); // payload was not delivered + } + #endif + + radio.startListening(); + + } + else + { + + uint8_t pipe; + + float receive[3]; + + if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&receive, bytes); // fetch payload from FIFO + //Serial.print("Received package \n"); + Ping = true; + + Serial.print(receive[0]); + Serial.print(","); + Serial.print(receive[1]); + Serial.print(","); + Serial.print(receive[2]); + Serial.println(); + + + } + + } + + +} // loop diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted/GettingStarted.ino b/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted/GettingStarted.ino index 70ac363a5157ba8e69682c03f54ed82dcbe52ae9..33478dd19e0246adcc61dbbfd7b6113832a16af3 100644 --- a/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted/GettingStarted.ino +++ b/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted/GettingStarted.ino @@ -27,7 +27,7 @@ uint8_t address[][6] = { "1Node", "2Node" }; bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit // Used to control whether this node is sending or receiving -bool role = false; // true = TX role, false = RX role +bool role = true; // true = TX role, false = RX role // For this example, we'll be using a payload containing // a single float number that will be incremented @@ -50,13 +50,13 @@ void setup() { // print example's introductory prompt Serial.println(F("RF24/examples/GettingStarted")); - // To set the radioNumber via the Serial monitor on startup - Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); - while (!Serial.available()) { - // wait for user input - } - char input = Serial.parseInt(); - radioNumber = input == 1; +// // To set the radioNumber via the Serial monitor on startup +// Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); +// while (!Serial.available()) { +// // wait for user input +// } +// char input = Serial.parseInt(); +// radioNumber = input == 1; Serial.print(F("radioNumber = ")); Serial.println((int)radioNumber); diff --git a/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted_dongle/GettingStarted_dongle.ino b/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted_dongle/GettingStarted_dongle.ino new file mode 100644 index 0000000000000000000000000000000000000000..0ef56f0264bbdce88039af74a73e276b5a0977a1 --- /dev/null +++ b/Documentation/Pre-projet/Custom Dongle/Arduino code/GettingStarted_dongle/GettingStarted_dongle.ino @@ -0,0 +1,156 @@ +/* + * See documentation at https://nRF24.github.io/RF24 + * See License information at root directory of this library + * Author: Brendan Doherty (2bndy5) + */ + +/** + * A simple example of sending data from 1 nRF24L01 transceiver to another. + * + * This example was written to be used on 2 devices acting as "nodes". + * Use the Serial Monitor to change each node's behavior. + */ +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + +// instantiate an object for the nRF24L01 transceiver +RF24 radio(9, 8); // using pin 7 for the CE pin, and pin 8 for the CSN pin + +// Let these addresses be used for the pair +uint8_t address[][6] = { "1Node", "2Node" }; +// It is very helpful to think of an address as a path instead of as +// an identifying device destination + +// to use different addresses on a pair of radios, we need a variable to +// uniquely identify which address this radio will use to transmit +bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +// Used to control whether this node is sending or receiving +bool role = true; // true = TX role, false = RX role + +// For this example, we'll be using a payload containing +// a single float number that will be incremented +// on every successful transmission +float payload= 0.0; + +void setup() { + + Serial.begin(115200); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + // print example's introductory prompt + Serial.println(F("RF24/examples/GettingStarted")); + +// // To set the radioNumber via the Serial monitor on startup +// Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); +// while (!Serial.available()) { +// // wait for user input +// } +// char input = Serial.parseInt(); +// radioNumber = input == 1; + Serial.print(F("radioNumber = ")); + Serial.println((int)radioNumber); + + // role variable is hardcoded to RX behavior, inform the user of this + Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); + + // Set the PA Level low to try preventing power supply related problems + // because these examples are likely run with nodes in close proximity to + // each other. + //radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + // save on transmission time by setting the radio to only transmit the + // number of bytes we need to transmit a float + radio.setDataRate(RF24_250KBPS); + + radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes + + // set the TX address of the RX node into the TX pipe + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + // set the RX address of the TX node into a RX pipe + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + // additional setup specific to the node's role + if (role) { + radio.stopListening(); // put radio in TX mode + } else { + radio.startListening(); // put radio in RX mode + } + + // For debugging info + // printf_begin(); // needed only once for printing details + // radio.printDetails(); // (smaller) function that prints raw register values + // radio.printPrettyDetails(); // (larger) function that prints human readable data + +} // setup + +void loop() { + + if (role) { + // This device is a TX node + + unsigned long start_timer = micros(); // start the timer + bool report = radio.write(&payload, sizeof(float)); // transmit & save the report + unsigned long end_timer = micros(); // end the timer + + if (report) { + Serial.print(F("Transmission successful! ")); // payload was delivered + Serial.print(F("Time to transmit = ")); + Serial.print(end_timer - start_timer); // print the timer result + Serial.print(F(" us. Sent: ")); + Serial.println(payload); // print payload sent + payload += 0.01; // increment float payload + } else { + Serial.println(F("Transmission failed or timed out")); // payload was not delivered + } + + // to make this example readable in the serial monitor + delay(1000); // slow transmissions down by 1 second + + } else { + // This device is a RX node + + uint8_t pipe; + if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&payload, bytes); // fetch payload from FIFO + Serial.print(F("Received ")); + Serial.print(bytes); // print the size of the payload + Serial.print(F(" bytes on pipe ")); + Serial.print(pipe); // print the pipe number + Serial.print(F(": ")); + Serial.println(payload); // print the payload's value + } + } // role + + if (Serial.available()) { + // change the role via the serial monitor + + char c = toupper(Serial.read()); + if (c == 'T' && !role) { + // Become the TX node + + role = true; + Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK")); + radio.stopListening(); + + } else if (c == 'R' && role) { + // Become the RX node + + role = false; + Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK")); + radio.startListening(); + } + } + +} // loop diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC/Code_Voiture_RC.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC/Code_Voiture_RC.ino new file mode 100644 index 0000000000000000000000000000000000000000..d2df72a44d8d2b5519c7c86461a3dc82c9cf83ce --- /dev/null +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC/Code_Voiture_RC.ino @@ -0,0 +1,154 @@ +/* + * See documentation at https://nRF24.github.io/RF24 + * See License information at root directory of this library + * Author: Brendan Doherty (2bndy5) + */ + +/** + * A simple example of sending data from 1 nRF24L01 transceiver to another. + * + * This example was written to be used on 2 devices acting as "nodes". + * Use the Serial Monitor to change each node's behavior. + */ +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + +// instantiate an object for the nRF24L01 transceiver +RF24 radio(8, 7); // using pin 7 for the CE pin, and pin 8 for the CSN pin + +// Let these addresses be used for the pair +uint8_t address[][6] = { "1Node", "2Node" }; +// It is very helpful to think of an address as a path instead of as +// an identifying device destination + +// to use different addresses on a pair of radios, we need a variable to +// uniquely identify which address this radio will use to transmit +bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +// Used to control whether this node is sending or receiving +bool role = false; // true = TX role, false = RX role + +// For this example, we'll be using a payload containing +// a single float number that will be incremented +// on every successful transmission +float payload = 0.0; + +void setup() { + + Serial.begin(115200); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + // print example's introductory prompt + Serial.println(F("RF24/examples/GettingStarted")); + + // To set the radioNumber via the Serial monitor on startup + Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); + while (!Serial.available()) { + // wait for user input + } + char input = Serial.parseInt(); + radioNumber = input == 1; + Serial.print(F("radioNumber = ")); + Serial.println((int)radioNumber); + + // role variable is hardcoded to RX behavior, inform the user of this + Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); + + // Set the PA Level low to try preventing power supply related problems + // because these examples are likely run with nodes in close proximity to + // each other. + radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + // save on transmission time by setting the radio to only transmit the + // number of bytes we need to transmit a float + radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes + + // set the TX address of the RX node into the TX pipe + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + // set the RX address of the TX node into a RX pipe + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + // additional setup specific to the node's role + if (role) { + radio.stopListening(); // put radio in TX mode + } else { + radio.startListening(); // put radio in RX mode + } + + // For debugging info + // printf_begin(); // needed only once for printing details + // radio.printDetails(); // (smaller) function that prints raw register values + // radio.printPrettyDetails(); // (larger) function that prints human readable data + +} // setup + +void loop() { + + if (role) { + // This device is a TX node + + unsigned long start_timer = micros(); // start the timer + bool report = radio.write(&payload, sizeof(float)); // transmit & save the report + unsigned long end_timer = micros(); // end the timer + + if (report) { + Serial.print(F("Transmission successful! ")); // payload was delivered + Serial.print(F("Time to transmit = ")); + Serial.print(end_timer - start_timer); // print the timer result + Serial.print(F(" us. Sent: ")); + Serial.println(payload); // print payload sent + payload += 0.01; // increment float payload + } else { + Serial.println(F("Transmission failed or timed out")); // payload was not delivered + } + + // to make this example readable in the serial monitor + delay(1000); // slow transmissions down by 1 second + + } else { + // This device is a RX node + + uint8_t pipe; + if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&payload, bytes); // fetch payload from FIFO + Serial.print(F("Received ")); + Serial.print(bytes); // print the size of the payload + Serial.print(F(" bytes on pipe ")); + Serial.print(pipe); // print the pipe number + Serial.print(F(": ")); + Serial.println(payload); // print the payload's value + } + } // role + + if (Serial.available()) { + // change the role via the serial monitor + + char c = toupper(Serial.read()); + if (c == 'T' && !role) { + // Become the TX node + + role = true; + Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK")); + radio.stopListening(); + + } else if (c == 'R' && role) { + // Become the RX node + + role = false; + Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK")); + radio.startListening(); + } + } + +} // loop diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC_tot/Code_Voiture_RC_tot.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC_tot/Code_Voiture_RC_tot.ino new file mode 100644 index 0000000000000000000000000000000000000000..6e06d7926e6de193fdc72449fe7190f568e3846a --- /dev/null +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/Code_Voiture_RC_tot/Code_Voiture_RC_tot.ino @@ -0,0 +1,33 @@ +/* + * See documentation at https://nRF24.github.io/RF24 + * See License information at root directory of this library + * Author: Brendan Doherty (2bndy5) + */ + +/** + * A simple example of sending data from 1 nRF24L01 transceiver to another. + * + * This example was written to be used on 2 devices acting as "nodes". + * Use the Serial Monitor to change each node's behavior. + */ +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + + + +void setup() { + + Serial.begin(115200); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + +} // setup + +void loop() { + + + +} // loop diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/Comande_preli/Comande_preli.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/Comande_preli/Comande_preli.ino index aec7d420d47406fbeec706d7049c103567d6528d..5e4d554a93ab07109794c02db22f94c8181c5cac 100644 --- a/Documentation/Pre-projet/Voiture RC/Code Arduino/Comande_preli/Comande_preli.ino +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/Comande_preli/Comande_preli.ino @@ -3,11 +3,31 @@ int val = 0; +#define frequencePWMde30hz 0b00000111 + +// Variables internes à ce programme +int valeurMaxRegistreOCR1x = 0; +int valeurRapportCycliquePwmPinD9; +int valeurRapportCycliquePwmPinD10; + void setup() { pinMode(PontHRouge,OUTPUT); pinMode(PontHNoir,OUTPUT); + // Sélection du mode "Phase Correct PWM 10 bits" + bitClear(TCCR1B, WGM13); // Mise à 0 de WGM13 + bitClear(TCCR1B, WGM12); // Mise à 0 de WGM12 + bitSet(TCCR1A, WGM11); // Mise à 1 de WGM11 + bitSet(TCCR1A, WGM10); // Mise à 1 de WGM10 + // Valeur max registre OCR1x + valeurMaxRegistreOCR1x = pow(2,10) - 1; + + TCCR1B &= 0b11111000; // <===== à ne pas toucher + TCCR1B |= frequencePWMde30hz; + + + Serial.begin(115200); while (!Serial) { @@ -19,15 +39,22 @@ void setup() { } void loop() { + + bitSet(TCCR1A, COM1A1); + bitClear(TCCR1A, COM1A0); // Mise en marche PWM D9 + + bitSet(TCCR1A, COM1B1); + bitClear(TCCR1A, COM1B0); // Mise en marche PWM D10 - if(val >= 0 ) + if(val >= 0 ) { - analogWrite(PontHRouge,abs(val)); - analogWrite(PontHNoir,abs(val)); + OCR1A = val * valeurMaxRegistreOCR1x; + OCR1B = val * valeurMaxRegistreOCR1x; } if(val < 0) { - analogWrite(PontHNoir,abs(val)); + OCR1A = 0 * valeurMaxRegistreOCR1x; + OCR1B = val * valeurMaxRegistreOCR1x; } if(Serial.available()){ diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/Commande_first/Commande_first.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/Commande_first/Commande_first.ino new file mode 100644 index 0000000000000000000000000000000000000000..0e97fe3c7d3ff7fd01f299f35ad8552238b61f83 --- /dev/null +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/Commande_first/Commande_first.ino @@ -0,0 +1,108 @@ +#define PontHRouge 10 +#define PontHNoir 9 + +int val = 0; + +#define frequencePWMde31372hz 0b00000001 +#define frequencePWMde3921hz 0b00000010 +#define frequencePWMde980hz 0b00000011 +#define frequencePWMde490hz 0b00000100 +#define frequencePWMde245hz 0b00000101 +#define frequencePWMde122hz 0b00000110 +#define frequencePWMde30hz 0b00000111 + +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + +// instantiate an object for the nRF24L01 transceiver +RF24 radio(8, 7); // using pin 7 for the CE pin, and pin 8 for the CSN pin + +// Let these addresses be used for the pair +uint8_t address[][6] = { "1Node", "2Node" }; +// It is very helpful to think of an address as a path instead of as +// an identifying device destination + +bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +// For this example, we'll be using a payload containing +// a single float number that will be incremented +// on every successful transmission +float payload[3]; + +void setup() { + + pinMode(PontHRouge,OUTPUT); + pinMode(PontHNoir,OUTPUT); + + TCCR1B &= 0b11111000; // <===== à ne pas toucher + TCCR1B |= frequencePWMde245hz; // <===== à changer, selon la fréquence que vous souhaitez en sortie + + + Serial.begin(9600); + + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + Serial.println("Test des commandes PWM voiture"); + + radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + // save on transmission time by setting the radio to only transmit the + // number of bytes we need to transmit a float + radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes + + // set the TX address of the RX node into the TX pipe + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + // set the RX address of the TX node into a RX pipe + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + radio.startListening(); + +} + +void loop() { + + if(val >= 0 ) + { + analogWrite(PontHRouge,abs(val)); + analogWrite(PontHNoir,abs(val)); + } + if(val < 0) + { + analogWrite(PontHNoir,abs(val)); + } + + if(Serial.available()){ + + val = Serial.readString().toInt(); + + Serial.println(val); + } + + uint8_t pipe; + if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&payload, bytes); // fetch payload from FIFO + + Serial.print(payload[0]); + Serial.print(":"); + Serial.print(payload[1]); + Serial.print(":"); + Serial.print(payload[2]); + Serial.print("\n"); + + +// radio.stopListening(); +// float payload[] = {1, 1 ,1}; +// radio.write(&payload,sizeof(payload)); +// +// radio.startListening(); + + + } + + +} diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted/GettingStarted.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted/GettingStarted.ino index d2df72a44d8d2b5519c7c86461a3dc82c9cf83ce..82ceeec5ce44f285f96113de79b9a0f984a2e27b 100644 --- a/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted/GettingStarted.ino +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted/GettingStarted.ino @@ -24,7 +24,7 @@ uint8_t address[][6] = { "1Node", "2Node" }; // to use different addresses on a pair of radios, we need a variable to // uniquely identify which address this radio will use to transmit -bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit +bool radioNumber = 0; // 0 uses address[0] to transmit, 1 uses address[1] to transmit // Used to control whether this node is sending or receiving bool role = false; // true = TX role, false = RX role @@ -50,13 +50,13 @@ void setup() { // print example's introductory prompt Serial.println(F("RF24/examples/GettingStarted")); - // To set the radioNumber via the Serial monitor on startup - Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); - while (!Serial.available()) { - // wait for user input - } - char input = Serial.parseInt(); - radioNumber = input == 1; +// // To set the radioNumber via the Serial monitor on startup +// Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); +// while (!Serial.available()) { +// // wait for user input +// } +// char input = Serial.parseInt(); +// radioNumber = input == 1; Serial.print(F("radioNumber = ")); Serial.println((int)radioNumber); diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted_voiture/GettingStarted_voiture.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted_voiture/GettingStarted_voiture.ino new file mode 100644 index 0000000000000000000000000000000000000000..a97f8ffe9bb233d45aa34b56422588391ea69779 --- /dev/null +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/GettingStarted_voiture/GettingStarted_voiture.ino @@ -0,0 +1,159 @@ +/* + * See documentation at https://nRF24.github.io/RF24 + * See License information at root directory of this library + * Author: Brendan Doherty (2bndy5) + */ + +/** + * A simple example of sending data from 1 nRF24L01 transceiver to another. + * + * This example was written to be used on 2 devices acting as "nodes". + * Use the Serial Monitor to change each node's behavior. + */ +#include <SPI.h> +#include "printf.h" +#include "RF24.h" + +// instantiate an object for the nRF24L01 transceiver +RF24 radio( 8,7); // using pin 7 for the CE pin, and pin 8 for the CSN pin + +// Let these addresses be used for the pair +uint8_t address[][6] = { "1Node", "2Node" }; +// It is very helpful to think of an address as a path instead of as +// an identifying device destination + +// to use different addresses on a pair of radios, we need a variable to +// uniquely identify which address this radio will use to transmit +bool radioNumber = 0; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +// Used to control whether this node is sending or receiving +bool role = false; // true = TX role, false = RX role + +// For this example, we'll be using a payload containing +// a single float number that will be incremented +// on every successful transmission +float payload = 0.0; + +void setup() { + + TCCR1B &= 0b11111000; // <===== à ne pas toucher + TCCR1B |= 0b00000101; // <===== à changer, selon la fréquence que vous souhaitez en sortie + + Serial.begin(115200); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + // print example's introductory prompt + Serial.println(F("RF24/examples/GettingStarted")); + +// // To set the radioNumber via the Serial monitor on startup +// Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); +// while (!Serial.available()) { +// // wait for user input +// } +// char input = Serial.parseInt(); +// radioNumber = input == 1; + Serial.print(F("radioNumber = ")); + Serial.println((int)radioNumber); + + // role variable is hardcoded to RX behavior, inform the user of this + Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); + + // Set the PA Level low to try preventing power supply related problems + // because these examples are likely run with nodes in close proximity to + // each other. + //radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + radio.setDataRate(RF24_250KBPS); + + // save on transmission time by setting the radio to only transmit the + // number of bytes we need to transmit a float + radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes + + // set the TX address of the RX node into the TX pipe + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + // set the RX address of the TX node into a RX pipe + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + // additional setup specific to the node's role + if (role) { + radio.stopListening(); // put radio in TX mode + } else { + radio.startListening(); // put radio in RX mode + } + + // For debugging info + // printf_begin(); // needed only once for printing details + // radio.printDetails(); // (smaller) function that prints raw register values + // radio.printPrettyDetails(); // (larger) function that prints human readable data + +} // setup + +void loop() { + + if (role) { + // This device is a TX node + + unsigned long start_timer = micros(); // start the timer + bool report = radio.write(&payload, 3* sizeof(float)); // transmit & save the report + unsigned long end_timer = micros(); // end the timer + + if (report) { + Serial.print(F("Transmission successful! ")); // payload was delivered + Serial.print(F("Time to transmit = ")); + Serial.print(end_timer - start_timer); // print the timer result + Serial.print(F(" us. Sent: ")); + Serial.println(payload); // print payload sent + payload += 0.01; // increment float payload + } else { + Serial.println(F("Transmission failed or timed out")); // payload was not delivered + } + + // to make this example readable in the serial monitor + delay(1000); // slow transmissions down by 1 second + + } else { + // This device is a RX node + + uint8_t pipe; + if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&payload, bytes); // fetch payload from FIFO + Serial.print(F("Received ")); + Serial.print(bytes); // print the size of the payload + Serial.print(F(" bytes on pipe ")); + Serial.print(pipe); // print the pipe number + Serial.print(F(": ")); + Serial.println(payload); // print the payload's value + } + } // role + + if (Serial.available()) { + // change the role via the serial monitor + + char c = toupper(Serial.read()); + if (c == 'T' && !role) { + // Become the TX node + + role = true; + Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK")); + radio.stopListening(); + + } else if (c == 'R' && role) { + // Become the RX node + + role = false; + Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK")); + radio.startListening(); + } + } + +} // loop diff --git a/Documentation/Pre-projet/Voiture RC/Code Arduino/Voiture_Finale/Voiture_Finale.ino b/Documentation/Pre-projet/Voiture RC/Code Arduino/Voiture_Finale/Voiture_Finale.ino new file mode 100644 index 0000000000000000000000000000000000000000..5750a1ddc00f00d127029469671d3da14bc2e422 --- /dev/null +++ b/Documentation/Pre-projet/Voiture RC/Code Arduino/Voiture_Finale/Voiture_Finale.ino @@ -0,0 +1,247 @@ +#include <SPI.h> +#include <PID_v2.h> +#include "printf.h" +#include "RF24.h" + +#define PontHRouge 10 +#define PontHNoir 9 + +#define DirPin 4 +// Droite 180 Gauche 850 + +double Kp=3,Ki=0,Kd=0.3;//ces valeurs ne sont pas les bonnes + +int aggressif = 40; +double Kpd=2.3,Kid=8,Kdd=0.2;//ces valeurs ne sont pas les bonnes + + +double Setpoint, Input, Output; //valeur visé pour les roues dans [-127,127], valeur réelle des roues dans [-127,127] et valeur de la commande des roues +PID myPID(&Input, &Output, &Setpoint,Kp,Ki,Kd, DIRECT); +bool turning; +int zone_morte=10; + + +#define PontG 5 +#define PontD 6 + +int val = 0; + +#define frequencePWMde31372hz 0b00000001 +#define frequencePWMde3921hz 0b00000010 +#define frequencePWMde980hz 0b00000011 +#define frequencePWMde490hz 0b00000100 +#define frequencePWMde245hz 0b00000101 +#define frequencePWMde122hz 0b00000110 +#define frequencePWMde30hz 0b00000111 + + +RF24 radio(8, 7); + +uint8_t address[][6] = { "1Node", "2Node" }; + + +bool radioNumber = 0; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +float payload[3] = {0.0,0.0,0.0}; +float sending[3] = {0.0, 0.0 ,0.0}; + +void setup() { + + Serial.begin(9600); + + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + pinMode(PontHRouge,OUTPUT); + pinMode(PontHNoir,OUTPUT); + + delay(10); + + TCCR1B &= 0b11111000; // <===== à ne pas toucher + TCCR1B |= frequencePWMde245hz; // <===== à changer, selon la fréquence que vous souhaitez en sortie + + + + //Serial.println("Test des commandes PWM voiture"); + Serial.println("angle commande"); + + //radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + radio.setDataRate(RF24_250KBPS); + + radio.setPayloadSize(sizeof(payload)); // float datatype occupies 4 bytes + + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + radio.startListening(); + + //configurer le PID + //configurer le PID + myPID.SetMode(AUTOMATIC); + myPID.SetOutputLimits(-255,255); + //demander de tourner + demarrer_virage(0); + +} + + +void loop() { + + if(val >= 0 ) + { + analogWrite(PontHRouge,abs(val)); + analogWrite(PontHNoir,abs(val)); + } + if(val < 0) + { + analogWrite(PontHNoir,abs(val)); + } + + if(Serial.available()){ + + val = Serial.readString().toInt(); + + Serial.println(val); + } + + uint8_t pipe; + if (radio.available(&pipe)) { + // is there a payload? get the pipe number that recieved it + uint8_t bytes = radio.getPayloadSize(); // get the size of the payload + radio.read(&payload, bytes); // fetch payload from FIFO + +// Serial.print(bytes); +// Serial.print(";"); +// Serial.print(payload[0]); +// Serial.print(":"); +// Serial.print(payload[1]); +// Serial.print(":"); +// Serial.print(payload[2]); +// Serial.print("\n"); + + val = payload[0]; + demarrer_virage(payload[1]); + + radio.stopListening(); + + delay(10); + + bool report = radio.write(&sending,sizeof(sending)); + +// if (report) { +// Serial.print(F("Transmission successful! ")); // payload was delivered +// } else { +// Serial.println(F("Transmission failed or timed out")); // payload was not delivered +// } + + radio.startListening(); + + + } + +// uint8_t pipe; +// if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it +// uint8_t bytes = radio.getPayloadSize(); // get the size of the payload +// radio.read(&payload, bytes); // fetch payload from FIFO +// Serial.print(F("Received ")); +// Serial.print(bytes); // print the size of the payload +// Serial.print(F(" bytes on pipe ")); +// Serial.print(pipe); // print the pipe number +// Serial.print(F(": ")); +// Serial.println(payload[0]); // print the payload's value +// } + if (turning) { + //on utilise un PID pour tourner + //Input = 127.0/335.0*(analogRead(DirPin)-180)-127;//on ramène l'angle du potentiomètre à l'interval [-127,127] + Input = 127.0/335.0*(analogRead(DirPin)-180)-127;//on ramène l'angle du potentiomètre à l'interval [-127,127] + + + if(abs(Input-Setpoint)>zone_morte) + { + + + + if ( abs(Input-Setpoint)<aggressif ) { + myPID.SetTunings(Kpd, Kid, Kdd); + } + else + { + myPID.SetTunings(Kp, Ki, Kd); + } + + + myPID.Compute();//on calcul l'output pour notre PID + //si on tombe dans la zone morte et que le virage est presque fini, on s'arrête là +// if (abs(Output)<zone_morte && abs(Input-Setpoint)<marge) { +// turning = false; +// stop_direction(); +// }//sinon on tourne très légèrement pour atteindre la valeur souhaitée +// else if (abs(Output)<zone_morte) { +// Output = 1.2*zone_morte*sign(Output); +// } + + //on applique la commande + if (Output>0) { + droite(abs(Output)); + } + else { + gauche(abs(Output)); + } + + } + else + { + + stop_direction(); + + } + } + + Serial.print(Input); + Serial.print(","); + Serial.print(Setpoint); + Serial.print(","); + Serial.print(Output); + Serial.println(); + sending[0]=Input; + sending[1]=Setpoint; + sending[2]=Output; + +} + +void demarrer_virage(int value) {//value est dans [-127,127] + turning=true; + Setpoint=value; +} + +//pour value<85, ça ne tourne plus, même quand les roues ne touchent pas le sol +void gauche(int value) { + analogWrite(PontG, value); + analogWrite(PontD, 0); +} + +void droite(int value) { + analogWrite(PontD, value); + analogWrite(PontG, 0); +} + +void stop_direction() { + analogWrite(PontD, 0); + analogWrite(PontG, 0); +} + +int sign(int value) { + if (value>=0) { + return 1; + } + return -1; +} diff --git a/Documentation/Projet/Arduino/PID_direction.ino b/Documentation/Projet/Arduino/PID_direction/PID_direction.ino similarity index 100% rename from Documentation/Projet/Arduino/PID_direction.ino rename to Documentation/Projet/Arduino/PID_direction/PID_direction.ino