| 78 | } |
| 79 | |
| 80 | void jammer() { |
| 81 | int methode = 1; |
| 82 | |
| 83 | if (methode == 1) { |
| 84 | const char text[] = { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, |
| 85 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 }; |
| 86 | |
| 87 | for (int i = ((channels * 5) + 1); i < ((channels * 5) + 23); i++) { |
| 88 | radioSetChannel(i); |
| 89 | radioA.write(&text, sizeof(text)); |
| 90 | radioB.write(&text, sizeof(text)); |
| 91 | radioC.write(&text, sizeof(text)); |
| 92 | |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | else if (methode == 2) { |
| 97 | radioSetChannel(channels); |
| 98 | int randomIndex = random(0, sizeof(wlanchannels) / sizeof(wlanchannels[channels])); |
| 99 | bool resultA = radioA.write(&randomIndex, sizeof(randomIndex)); |
| 100 | bool resultB = radioB.write(&randomIndex, sizeof(randomIndex)); |
| 101 | bool resultC = radioC.write(&randomIndex, sizeof(randomIndex)); |
| 102 | } |
| 103 | |
| 104 | else if (methode == 3) { |
| 105 | for (int i = 0; i < 22; i++) { // Jam across 22 channels |
| 106 | int channelA = ((channels * 5) + 1) + i; |
| 107 | int channelB = ((channels * 5) + 1) + i + 1; |
| 108 | int channelC = ((channels * 5) + 1) + i + 2; |
| 109 | |
| 110 | int randomIndex = random(0, sizeof(wlanchannels) / sizeof(wlanchannels[0])); |
| 111 | |
| 112 | radioA.setChannel(channelA); |
| 113 | radioB.setChannel(channelB); |
| 114 | radioC.setChannel(channelC); |
| 115 | |
| 116 | radioA.write(&randomIndex, sizeof(randomIndex)); |
| 117 | radioB.write(&randomIndex, sizeof(randomIndex)); |
| 118 | radioC.write(&randomIndex, sizeof(randomIndex)); |
| 119 | |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | void pressBt01() { |
| 125 | static unsigned long last_interrupt_time = 0; |
no test coverage detected