Search the Community
Showing results for tags 'arduino'.
-
I used this guide to try to make my very first thing with arduino and I thought what better than to make my own temperature sensor to put into my PC. I used this guide to help me: https://www.instructables.com/Arduino-LCD-Computer-Temperature-Monitor/ Figured I'd be pretty simple I installed Arduino IDE and ran the ArduinoOHM exe after uploading the code with the COM3 port active but the GPU and CPU temps are displayed as zero but the temperature sensor I put in there works perfectly. I also had open hardware monitor running in the background throughout all of this so should be a non issue. And yes I am using a flash drive to prop up the LCD against the pin headers because I don't want to directly solder yet. Also I don't have much experience with this so if you could explain to me as if I'm a child that'd be great
-
- arduino
- arduino uno
-
(and 1 more)
Tagged with:
-
Just purchased a bundle of 5 esp8266 D1 minis from AliExpress. I was going to make just one Wifi deauthor/Wifi nugget device, but it wasn't that much more expensive to buy 5 and a bunch of screens and bits. Wondering what other projects people use them for. I saw a thread where someone was trying to make a simple KVM with one. I was thinking it could be a simple silent alarm if possible.
-
To preface this, I'm a total newbie with Arduino and OOP in general. My current project is an automatic pet feeder, and I just need to make an SG90 mini-servo rotate 90 degrees and back, and repeat that action every 6 hours. No idea how to do this, any help would be great.
-
So i have a esd motor thati wana put on an RC car that was working with gas and i wanted to trasle the signal from a servo that acted like a gas pedal for the old motor into an esd signal si i can make it work with a bldc motor here is the code i have made so far the signal coming from the rc recever is for servos so that way can only get input like that my signal is from -255 to 255 i need to make a pwm signal betwin 1 ms(stop) to 2 ms(full throtle) and i dont now how to translate the signla At first i was making this whit a DC motor whith a h bridged thx for your time btw #include <Servo.h> #include <ServoInput.h> #define enA 3 #define in1 4 #define in2 5 int rotDirection = 0; int pressed = false; /* Signal pins for ServoInput MUST be interrupt-capable pins! * Uno, Nano, Mini (328P): 2, 3 * Micro, Leonardo (32U4): 0, 1, 2, 3, 7 * Mega, Mega2560: 2, 3, 18, 19, 20, 21 * Reference: https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/ */ // Steering Setup //const int SteeringSignalPin = 2; // MUST be interrupt-capable! //const int SteeringPulseMin = 1000; // microseconds (us) //const int SteeringPulseMax = 2000; // Ideal values for your servo can be found with the "Calibration" example //ServoInputPin<SteeringSignalPin> steering(SteeringPulseMin, SteeringPulseMax); Servo ESC; // create servo object to control the ESC int potValue; // value from the analog pin // Throttle Setup const int ThrottleSignalPin = 2; // MUST be interrupt-capable! const int ThrottlePulseMin = 1023; // microseconds (us) const int ThrottlePulseMax = 1898; // Ideal values for your servo can be found with the "Calibration" example ServoInputPin<2> throttle(1023, 1898); void setup() { Serial.begin(115200); // Attach the ESC on pin 9 ESC.attach(9,1000,2000); // (pin, min pulse width, max pulse width in microseconds) pinMode(enA, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); while (!ServoInput.available()) { // wait for all signals to be ready Serial.println("Waiting for servo signals..."); delay(500); } } void loop() { potValue = 2; // reads the value of the potentiometer (value between 0 and 1023) potValue = map(potValue, 0, 1023, 0, 180); // scale it to use it with the servo library (value between 0 and 180) ESC.write(potValue); // Send the signal to the ESC Serial.print(potValue); Serial.print("RC - "); // float steeringAngle = 90.0 - steering.getAngle(); // returns 0 - 180, subtracting from 90 to center at "0" and invert for "normal" steering // Serial.print("Steering: "); // Serial.print(steeringAngle); // Serial.print("deg"); // Serial.print(" | "); // separator int throttlePercent = throttle.map(-255, 255); // remap to a percentage both forward and reverse Serial.print("Throttle: "); Serial.print(throttlePercent); Serial.print("% "); analogWrite(enA, throttlePercent); // digitalWrite(in1, HIGH); // digitalWrite(in2, LOW); // if (throttlePercent <= 0){ // analogWrite(enA, throttlePercent *-1); // // } if (throttlePercent >= 0) { Serial.print("(Forward)"); digitalWrite(in1, HIGH); digitalWrite(in2, LOW); } else{ //digitalWrite(enA, LOW); } if (throttlePercent <= 0) { Serial.print("(Reverse)"); digitalWrite(in1, LOW); digitalWrite(in2, HIGH); } else{ //digitalWrite(enA, LOW); } if (throttlePercent >= 0) { Serial.print("(Forward)"); } else { Serial.print("(Reverse)"); } Serial.println(); }
-
Hey Guys! I hooked up my WS2812 Led Strip to my Arduino and programmed a Light-Mode, but i can't explain myself why the variable "a" isnt getting count up. Code: #include <FastLED.h> #define LED_PIN 2 #define NUM_LEDS 25 CRGB leds[NUM_LEDS]; int segNr = 0; void setup() { FastLED.addLeds<WS2812, LED_PIN, RBG>(leds, NUM_LEDS); FastLED.setMaxPowerInVoltsAndMilliamps(5, 500); FastLED.clear(); FastLED.show(); Serial.begin(9600); Serial.print("Setup 1: "); Serial.println(segNr); segNr = 15; Serial.print("Setup 2: "); Serial.println(segNr); } void loop() { // put your main code here, to run repeatedly: //leds[0] = CRGB(255, 0, 0); //leds[1] = CRGB(0, 255, 0); //leds[2] = CRGB(0, 0, 255); nightrider(); } void nightrider() { Serial.print("Anfang: "); Serial.println(segNr); if (segNr >= 25) { Serial.print("Reset: "); Serial.println(segNr); segNr = 0; } else { Serial.print("Set 1: "); Serial.println(segNr); for (int i = 0; i <= NUM_LEDS; i++) { leds[i] = CRGB(255, 255, 255); } Serial.print("Set 2: "); Serial.println(segNr); leds[segNr] = CRGB(255, 0, 0); } FastLED.show(); delay(500); segNr++; Serial.print("Ende: "); Serial.println(segNr); } void randomcoloreffect() { for (int i = 0; i <= 25; i++) { leds[i] = CRGB(random(0, 255), random(0, 255), random(0, 255)); } FastLED.show(); delay(1000); } My Serial output is really weird because im getting "0" at "Set1:" and "-1" at "Set2".But i dont know why the for loop effects the a variable. Thanks for your help.
- 2 replies
-
- arduino
- arduino uno
-
(and 1 more)
Tagged with:
-
Hey everyone, I am a little newer to single board computers and I am trying to do a project where I need to store a series of XML files on a single board computer. I want to mirror the data on to a second SD card. Does anyone have suggestions on hats for pi's/arduinos or if there is already a single board computer on the market with multiple SD card slots. Thanks, Shock
- 3 replies
-
- redundancy
- raspberry pi
-
(and 2 more)
Tagged with:
-
Hello all, I have an Arduino that I am trying to turn into a sports ticker with a led screen I had laying around. I am wondering if this is something that I can do by ripping data off of ESPN or some similar website every few minutes. My other option would be to try to do this with a raspberry pi, but I am not as good at programming with it. Something I could learn, but was curious if any of you have found a way to do it. If not then can you help point me in the right direction for how to do this with a raspberry pi. Thank you in advance for the help.
- 2 replies
-
- arduino
- raspberry pi
-
(and 1 more)
Tagged with:
-
Hi guys, I was just working with a 16x2 display on a Arduino, it worked just fine but then I remove a soldered wire with hot air and now it just doesn't work, I disassembled the lcd and clean with alcohol the internal connections and redo the Arduino wiring, but still nothing...
-
This is a extremely simple project, but, it saves me so much time. One of the things that started happening way to often is, I'm not the one who is misplacing the TV remote but I'm always the one recruited to find it... which is not fun. So I built my own WiFi remote, it sits on a shelf and I interact with it with my phone and PC. Honestly, I wish my smart TV has this feature since now I don't even need the remote that came with the TV. Hopefully someone else finds this useful too.
-
Hello everyone, I'm going to be making a wall mounted pc and it's going to be a bit far from my desk, so I was thinking that if there was some sort of device that connects to home wifi and to the power pins on the mobo to act like a power button and can be activated from a mobile phone that would be sick. I looked around but couldn't quite find anything, I was thinking even an Arduino could work with coding but they're quite expensive and I don't know how to code anyways, if anyone has any ideas that would be sick if you could drop them down below, thanks!
-
Heyo! I am in the midst of a Simracing wheel-rim DIY, and my Arduino/Coding skills are lackluster. I'm using a ATMEGA32U4 for a Porsche 911 gt3 cup button box + shifters. 10 push buttons, 2 paddle shifters and 2 encoders. = 16 outputs total as the encoders have 2 each. also want to solder a DIN connection to the board, and havent looked up how to do that yet eather. where i am stuck at is that i found a sketch that works from pin 2-10, 14-16. so im missing 1,11,12,13. the visible buttons on the board are 2-10,14-16, A0-A3. so im guessing i need some code to set up A0-A3 as normal pins. also i need code for the Encoders to be correctly red. atm they dont work propperly, (dont work as an individual puls every time i switch position). here are some pictures to feast your eyes on. Any help would be much apprichated! Brg Roth
-
Hi, i currently have a unity face and hand recognition and gesture software where it outlines your hand in a green square and identifies what gesture you are doing. I want to output the movements to a java or python program (unsure which one) to control a robotic arm I have built. But the unity file has no way of recording coordinates and I am asking if anyone knows anything else I can use, how i can get the coordinates, or if there is software that can track the green square across my screen and create coordinates based off my monitor.
-
Hi all, some days ago I got a leftover RGB strip from a friend of mine, and since then my life has changed. An idea torments me: I like the way they look (hooked them up to a molex) but I would like them to be useful rather then beautiful. I've done a TON of research, but it looks like what I'm trying to accomplish is too specific to be found. My chrome's bookmark list lately consists in just this topic (send help): My plan is to have the LED strip cut in half (two strips, each having 3 LEDs) and have one strip controlled by CPU temp, and the other one by GPU temp: if the temperature is cool the LED will glow blue, if it's hot it will glow red. One thing to know: I know very little about electronics, if anything at all. Sorry in advance for my ignorance LEDs specs: one strip of 6 RGB LEDs @5V (1,44W, 0,288A) Without further talking, here's my two ideas: 1) The quick and simpler one: T1 and T3 transistors are NPN, T2 and T4 are PNP Basically, if the PWM signal is "low", T2 and T4 will output a high current to the LEDs, therefore making them glow blue (PWM low = fans not spinning, or spinning slow = low temperature) while T1 and T3 will output a small current, if any; if the PWM is "high", the contrary happens. Violet will appear at some point (red + blue = violet), but it's ok 2) The arduino way, which is pretty self-explanatory: it will be connected via a virtual serial port, and it will read CPU and GPU temps using some software such as SpeedFan or so. These programs will be logging temps, and I'll need to write another program to send those values to the arduino. I'll need to write a script for the arduino too, so that it knows what to do with those values. This is the best option because it reads the real temperatures, but being this a small project I think it would be a little bit overkill (maybe I'll do it in the future) I'm ready to buy resistors and transistors, but I would like to know what components I should choose, or even if this is possible to do. If I (more like "us", or to be more correct "you", hypothetical helper) manage to make it work, I will be glad to make a video step by step so that other people don't run in the RGB hell, which is only red. Because I use the 5V molex right now. And it's on red. Thanks in advance PS: I know it's off-topic, but I've read some topics here and...no wars ? No poisonous comments ? You've built up a nice community, it's nice to be here !
-
After a recent purchase of a Nvidia GTX1080 graphics card, 4k monitor plus Doom. I thought it would be great to see some external telemetry... from my expensive purchase. Tiny 0.96" OLED display (hence "Gnat-Stats) The SerialSender application uses the open source OpenHardwareMonitorLib.dll to sniff the sensors of most modern dedicated PC graphics, CPU and motherboards whilst, also pooling windows hardware stats. Lego for Scale Very Experimental!!!
-
Hello everybody! A friend of mine made a DIY motorized Gimbal with Arduino. It includes some elements of sustainable development so he is entering a competition in which public opinion on the project matters, so he wants to show off a little. Here is a Youtube link, if you like the project, could you leave a like or a comment? It would help him a great deal. (linked to 1m30s, but feel free to watch the whole video!) If you have any questions about the technical side of this project you can ask and I'll ask him.
-
So first of all what I am asking is if I can have help with this. My Arduino code: #include <SPI.h> #include <Ethernet2.h> int led = 13; String POST = ""; String SET = ""; // Enter a MAC address and IP address for your controller below. // The IP address will be dependent on your local network: byte mac[] = { 0x90, 0xA2, 0xDA, 0x10, 0x8B, 0xBF }; IPAddress ip(192,168,1,179); // Initialize the Ethernet server library // with the IP address and port you want to use // (port 80 is default for HTTP): EthernetServer server(80); void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); // start the Ethernet connection and the server: Ethernet.begin(mac, ip); server.begin(); Serial.print("server is at "); Serial.println(Ethernet.localIP()); pinMode(led, OUTPUT); } void loop() { // listen for incoming clients EthernetClient client = server.available(); if (client) { Serial.println("new client"); // an http request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); // if you've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connnection: close"); client.println(); client.println(""); client.println("Jack's Arudino"); client.println(""); client.println(""); client.println(""); client.println("<h1>Control Jack's LED</h1>"); client.print("<form method=get>"); client.print("<input type='radio' value='0'> Off<br>"); client.print("<input type='radio' value='1'> On<br>"); client.print("<input type=submit value=submit></form>"); client.print("</form>"); client.println(""); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(1); } if(SET == "on"){ digitalWrite(led, HIGH); } else{ digitalWrite(led, LOW); } } So when I run this code, I can connect to the web page 192.168.1.179 and it all works, but when I click, lets say the off box the LED switches off for a second and then comes back on. Like what is this magic? So I am asking for help to sort this out so the LED will actually turn off, and also my next step after this will be to make it so when I type say '192.168.1.179/?0' it turns the LED off and when I type '192.168.1.179/?1' it turns the LED on. This will then lead me to making my own Android app. Thanks
- 10 replies
-
- arduino
- programming
-
(and 3 more)
Tagged with:
-
I am a new coder... i have done a substantial amount of research and cant seem to find an answer. in the code below, when i have the head-shot percentage print. it is ALWAYS 0% and I cant seem to find out why. Any suggestions? The ENTIRE code (the information you need is toward the bottom): /////////////////////////////////////////////////////////////////////// Weapon Kill definiton(s) //Pistol Kill Variable(s) #define USPSkill ak1 #define P2000kill ak2 #define GLOCK18kill ak3 #define DUEL_BERRETASkill ak4 #define DULIESkill DUEL_BERRETASkill #define P250kill bk1 //#define p228kill // 1.6, CSS #define CZ75kill bk2 #define FIVESEVENkill ck1 #define TEC9kill ck2 #define DESERT_EAGLEkill dk1 #define DEAGLE DESERT_EAGLEkill #define R8_REVOLVERkill ak5 #define REVOLVERkill R8_REVOLVERkill //SMG Kill Variable(s) #define MAC10kill ak6 #define MP9kill ak7 //#define TMPkill // 1.6, CSS #define MP7kill ak8 //#define MP5kill // 1.6, CSS #define UMP45kill bk3 #define P90kill ck3 #define PPBIZONkill ak9 #define BIZONkill PPBIZONkill //Rifle Kill Variable(s) #define FAMASkill ak10 #define GALILARkill ak15 #define GALILkill GALILARkill #define AK47kill bk4 #define M4A1Skill bk5 #define M4A4kill bk6 #define AUGkill ck4 #define SG553kill ck5 #define SGkill SG553kill //#define SG552kill // 1.6, CSS //Sniper Kill Variable(s) #define SSG08kill dk2 #define SCOUTkill SSG08kill #define SSGkill SSG08kill #define AWPkill dk3 #define SCAR20kill ck6 #define CT-AUTOkill #define G3SG1kill ck7 #define T-AUTOkill G3SG1 //Shotgun Kill Variable(s) #define MAG7kill ak11 #define SAWEDOFFkill ak12 #define XM1014kill ak13 #define AUTOSHOTTYkill XM1014 #define NOVAkill ak14 //#define BENELLI_M3kill // 1.6, CSS //LMG Kill Variable(s) #define M249kill ck8 #define NEGEVkill ck9 //Other (Weapon) Kill Variable(s) #define GRENADEkill dk4 //Expand in the future ie HE, Flash, Decoy, Etc #define KNIFEkill dk5 /////////////////////////////////////////////////////////////////////// Weapon Kill Sums #define ak ak1+ak2+ak3+ak4+ak5+ak6+ak7+ak8+ak9+ak10+ak11+ak12+ak13+ak14 //ak 1-14 #define bk bk1+bk2+bk3+bk4+bk5+bk6 //bk 1-6 #define ck ck1+ck2+ck3+ck4+ck5+ck6+ck7+ck8+ck9 //ck 1-9 #define dk dk1+dk2+dk3+dk4+dk5//dk 1-5 #define KTotal ak+bk+ck+dk//Counts Total of Kills /////////////////////////////////////////////////////////////////////// Weapon Kill Integer(s) //Pistol Kill Integer(s) int USPSkill = ak1 ; int P2000kill = ak2 ; int GLOCK18kill = ak3 ; int DUEL_BERRETASkill = ak4 ; int P250kill = bk1 ; //int p228kill = // 1.6, CSS int CZ75kill = bk2 ; int FIVESEVENkill = ck1 ; int TEC9kill = ck2 ; int DESERT_EAGLEkill = dk1 ; int R8_REVOLVERkill = ak5 ; //SMG Kill Integer(s) int MAC10kill = ak6 ; int MP9kill = ak7 ; //int TMPkill = // 1.6, CSS int MP7kill = ak8 ; //int MP5kill = // 1.6, CSS int UMP45kill = bk3 ; int P90kill = ck3 ; int PPBIZONkill = ak9 ; //Rifle Kill Integer(s) int FAMASkill = ak10 ; int GALILARkill = ak15 ; int AK47kill = bk4 ; int M4A1Skill = bk5 ; int M4A4kill = bk6 ; int AUGkill = ck4 ; int SG553kill = ck5 ; //int SG552kill = // 1.6, CSS //Sniper Kill Integer(s) int SSG08kill = dk2 ; int AWPkill = dk3 ; int SCAR20kill = ck6 ; int G3SG1kill = ck7 ; //Shotgun Kill Integer(s) int MAG7kill = ak11 ; int SAWEDOFFkill = ak12 ; int XM1014kill = ak13 ; int NOVAkill = ak14 ; //int BENELLI_M3kill = 0// 1.6, CSS //LMG Kill Integer(s) int M249kill = ck8 ; int NEGEVkill = ck9 ; //Other (Weapon) Kill Integer(s) int GRENADEkill = dk4 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEkill = dk5 ; /////////////////////////////////////////////////////////////////////// Weapon Assist definiton(s) //Pistol Assist Variable(s) #define USPSassist aa1 #define P2000assist aa2 #define GLOCK18assist aa3 #define DUEL_BERRETASassist aa4 #define DULIESassist DUEL_BERRETASassist #define P250assist ba1 //#define p228assist // 1.6, CSS #define CZ75assist ba2 #define FIVESEVENassist ca1 #define TEC9assist ca2 #define DESERT_EAGLEassist da1 #define DEAGLE DESERT_EAGLEassist #define R8_REVOLVERassist aa5 #define REVOLVERassist R8_REVOLVERassist //SMG Assist Variable(s) #define MAC10assist aa6 #define MP9assist aa7 //#define TMPassist // 1.6, CSS #define MP7assist aa8 //#define MP5assist // 1.6, CSS #define UMP45assist ba3 #define P90assist ca3 #define PPBIZONassist aa9 #define BIZONassist PPBIZONassist //Rifle Assist Variable(s) #define FAMASassist aa10 #define GALILARassist aa15 #define GALILassist GALILARassist #define AK47assist ba4 #define M4A1Sassist ba5 #define M4A4assist ba6 #define AUGassist ca4 #define SG553assist ca5 #define SGassist SG553assist //#define SG552assist // 1.6, CSS //Sniper Assist Variable(s) #define SSG08assist da2 #define SCOUTassist SSG08assist #define SSGassist SSG08assist #define AWPassist da3 #define SCAR20assist ca6 #define CT-AUTOassist #define G3SG1assist ca7 #define T-AUTOassist G3SG1 //Shotgun Assist Variable(s) #define MAG7assist aa11 #define SAWEDOFFassist aa12 #define XM1014assist aa13 #define AUTOSHOTTYassist XM1014assist #define NOVAassist aa14 //#define BENELLI_M3assist // 1.6, CSS //LMG Assist Variable(s) #define M249assist ca8 #define NEGEVassist ca9 //Other (Weapon) Assist Variable(s) #define GRENADEassist da4 //Expand in the future ie HE, Flash, Decoy, Etc #define KNIFEassist da5 /////////////////////////////////////////////////////////////////////// Weapon Assist Sums #define aa aa1+aa2+aa3+aa4+aa5+aa6+aa7+aa8+aa9+aa10+aa11+aa12+aa13+aa14 //aa 1-14 #define ba ba1+ba2+ba3+ba4+ba5+ba6 //ba 1-6 #define ca ca1+ca2+ca3+ca4+ca5+ca6+ca7+ca8+ca9 //ca 1-9 #define da da1+da2+da3+da4+da5//da 1-5 #define ATotal aa+ba+ca+da//Counts Total of Assists /////////////////////////////////////////////////////////////////////// Weapon Assist Integer(s) //Pistol Assist Integer(s) int USPSassist = 0 ; int P2000assist = 0 ; int GLOCK18assist = 0 ; int DUEL_BERRETASassist = 0 ; int P250assist = 0 ; //int p228assist = // 1.6, CSS int CZ75assist = 0 ; int FIVESEVENassist = 0 ; int TEC9assist = 0 ; int DESERT_EAGLEassist = da1 ; int R8_REVOLVERassist = aa5 ; //SMG Assist Integer(s) int MAC10assist = 0 ; int MP9assist = 0 ; //int TMPassist = // 1.6, CSS int MP7assist = 0 ; //int MP5assist = // 1.6, CSS int UMP45assist = 0 ; int P90assist = 0 ; int PPBIZONassist = 0 ; //Rifle Assist Integer(s) int FAMASassist = 0 ; int GALILARassist = 0 ; int AK47assist = 0 ; int M4A1Sassist = 0 ; int M4A4assist = 0 ; int AUGassist = 0 ; int SG553assist = 0 ; //int SG552assist = // 1.6, CSS //Sniper Assist Integer(s) int SSG08assist = 0 ; int AWPassist = 0 ; int SCAR20assist = 0 ; int G3SG1assist = 0 ; //Shotgun Assist Integer(s) int MAG7assist = 0 ; int SAWEDOFFassist = 0 ; int XM1014assist = 0 ; int NOVAassist = 0 ; //int BENELLI_M3assist = 0// 1.6, CSS //LMG Assist Integer(s) int M249assist = 0 ; int NEGEVassist = 0 ; //Other (Weapon) Assist Integer(s) int GRENADEassist = 0 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEassist = 0 ; /////////////////////////////////////////////////////////////////////// Weapon Death definiton(s) //Pistol Death Variable(s) #define USPSdeath ad1 #define P2000death ad2 #define GLOCK18death ad3 #define DUEL_BERRETASdeath ad4 #define DULIESdeath DUEL_BERRETASdeath #define P250death bd1 //#define p228death // 1.6, CSS #define CZ75death bd2 #define FIVESEVENdeath cd1 #define TEC9death cd2 #define DESERT_EAGLEdeath dd1 #define DEAGLE DESERT_EAGLEdeath #define R8_REVOLVERdeath ad5 #define REVOLVERdeath R8_REVOLVERdeath //SMG Death Variable(s) #define MAC10death ad6 #define MP9death ad7 //#define TMPdeath // 1.6, CSS #define MP7death ad8 //#define MP5death // 1.6, CSS #define UMP45death bd3 #define P90death cd3 #define PPBIZONdeath ad9 #define BIZONdeath PPBIZONdeath //Rifle Death Variable(s) #define FAMASdeath ad10 #define GALILARdeath ad15 #define GALILdeath GALILARdeath #define AK47death bd4 #define M4A1Sdeath bd5 #define M4A4death bd6 #define AUGdeath cd4 #define SG553death cd5 #define SGdeath SG553death //#define SG552death // 1.6, CSS //Sniper Death Variable(s) #define SSG08death dd2 #define SCOUTdeath SSG08death #define SSGdeath SSG08death #define AWPdeath dd3 #define SCAR20death cd6 #define CT-AUTOdeath #define G3SG1death cd7 #define T-AUTOdeath G3SG1 //Shotgun Death Variable(s) #define MAG7death ad11 #define SAWEDOFFdeath ad12 #define XM1014death ad13 #define AUTOSHOTTYdeath XM1014 #define NOVAdeath ad14 //#define BENELLI_M3death // 1.6, CSS //LMG Death Variable(s) #define M249death cd8 #define NEGEVdeath cd9 //Other (Weapon) Death Variable(s) #define GRENADEdeath dd4 //Expand in the future ie HE, Flash, Decoy, Etc #define KNIFEdeath dd5 /////////////////////////////////////////////////////////////////////// Weapon Death Sums #define ad ad1+ad2+ad3+ad4+ad5+ad6+ad7+ad8+ad9+ad10+ad11+ad12+ad13+ad14+ad15 //ad 1-15 #define bd bd1+bd2+bd3+bd4+bd5+bd6 //bd 1-6 #define cd cd1+cd2+cd3+cd4+cd5+cd6+cd7+cd8+cd9 //cd 1-9 #define dd dd1+dd2+dd3+dd4+dd5//dd 1-5 #define DTotal ad+bd+cd+dd//Counts Total of Deaths /////////////////////////////////////////////////////////////////////// Weapon death Integer(s) //Pistol Death Integer(s) int USPSdeath = 0 ; int P2000death = 0 ; int GLOCK18death = 0 ; int DUEL_BERRETASdeath = 0 ; int P250death = 0 ; //int p228death = // 1.6, CSS int CZ75death = 0 ; int FIVESEVENdeath = 0 ; int TEC9death = 0 ; int DESERT_EAGLEdeath = 0 ; int R8_REVOLVERdeath = 0 ; //SMG Death Integer(s) int MAC10death = 0 ; int MP9death = 0 ; //int TMPdeath = // 1.6, CSS int MP7death = 0 ; //int MP5death = // 1.6, CSS int UMP45death = 0 ; int P90death = 0 ; int PPBIZONdeath = 0 ; //Rifle Death Integer(s) int FAMASdeath = 0 ; int GALILARdeath = 0 ; int AK47death = 0 ; int M4A1Sdeath = 0 ; int M4A4death = 0 ; int AUGdeath = 0 ; int SG553death = 0 ; //int SG552death = // 1.6, CSS //Sniper Death Integer(s) int SSG08death = 0 ; int AWPdeath = 0 ; int SCAR20death = 0 ; int G3SG1death = 0 ; //Shotgun Death Integer(s) int MAG7death = 0 ; int SAWEDOFFdeath = 0 ; int XM1014death = 0 ; int NOVAdeath = 0 ; //int BENELLI_M3death = 0// 1.6, CSS //LMG Death Integer(s) int M249death = 0 ; int NEGEVdeath = 0 ; //Other (Weapon) Death Integer(s) int GRENADEdeath = 0 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEdeath = 0 ; /////////////////////////////////////////////////////////////////////// Variable(s) //Score Variable(s) int x = 0 ;//Rounds won int y = 0 ;//Rounds lost //Round Impact Variable(s) int k5 = 0 ;//ACE int k4 = 0 ;//4k int ds = 0 ;//suicide int kf = 0 ;//teamkill //Kill Variables(s) (for intermediate mode) int aks = 0 ;//Weapon class A Kill int bks = 0 ;//Weapon class B Kill int cks = 0 ;//Weapon class C Kill int dks = 0 ;//Weapon class D Kill //Assist Variable(s) (for intermediate mode) int aas = 0 ;//Weapon class A Assist int bas = 0 ;//Weapon class B Assist int cas = 0 ;//Weapon class C Assist int das = 0 ;//Weapon class D Assist //Death Variables (for intermediate mode) int ads = 0 ;//Weapon class A Death int bds = 0 ;//Weapon class B Death int cds = 0 ;//Weapon class C Death int dds = 0 ;//Weapon class D Death //Headshot Variable(s) int hk = 0 ;//Headshots //Other Variable(s) int KA = 0 ;//Kills without Weapon skill class (for simple mode) int AA = 0 ;//Assists without Weapon skill class (for simple mode) int DA = 0 ;//Deaths without Weapon skill class (for simple mode) /////////////////////////////////////////////////////////////////////// Score definition(s) #define R 4*(x-y) //Round Score #define P k5+((4*k4)/5)-(ds+kf) //Round Impact Score #define K ak+(1.25*bk)+(.5*ck)+(2*dk) //Kill Score (based on weapon skill) #define A (aa+(1.25*ba)+(.5*ca)+(2*da))/2 //Assist Score (based on weapon skill) #define H .2*hk //Headshot Score #define D ad+(bd/1.25)+(cd/.5)+(dd/2) //Death Score (based on weapon skill) #define ELO R+P+(K+A+H)/D //Overall Elo Score #define KDR KTotal/DTotal //Kill Death Ratio #define HSR (hk/KTotal)*100 //Headshot Percentage /////////////////////////////////////////////////////////////////////// // Full Equation (4(x-y)) + (k5+((4*k4)/5)-(ds+kf)) + (((ak+(1.25*bk)+(.5*ck)+(2*dk)) + (.5(aa+(1.25*ba)+(.5*ca)+(2*da))))+(.2*h)/(ad+(bd/1.25)+(cd/.5)+(dd/2))) /////////////////////////////////////////////////////////////////////// Question Variable(s) [and STOP Variable] int RoundsWonQuestion = 1; int RoundsLostQuesiton = 1; int AceQuestion = 1; int FourkQuestion = 1; int SuicideQuestion = 1; int TeamkillQuestion = 1; int HeadshotQuestion = 1; //Pistol killQuestion Integer(s) int USPSkillQuestion = 1 ; int P2000killQuestion = 1 ; int GLOCK18killQuestion = 1 ; int DUEL_BERRETASkillQuestion = 1 ; int P250killQuestion = 1 ; //int p228killQuestion = 1// 1.6, CSS int CZ75killQuestion = 1 ; int FIVESEVENkillQuestion = 1 ; int TEC9killQuestion = 1 ; int DESERT_EAGLEkillQuestion = 1 ; int R8_REVOLVERkillQuestion = 1 ; //SMG killQuestion Integer(s) int MAC10killQuestion = 1 ; int MP9killQuestion = 1 ; //int TMPkillQuestion = 1// 1.6, CSS int MP7killQuestion = 1 ; //int MP5killQuestion = 1// 1.6, CSS int UMP45killQuestion = 1 ; int P90killQuestion = 1 ; int PPBIZONkillQuestion = 1 ; //Rifle killQuestion Integer(s) int FAMASkillQuestion = 1 ; int GALILARkillQuestion = 1 ; int AK47killQuestion = 1 ; int M4A1SkillQuestion = 1 ; int M4A4killQuestion = 1 ; int AUGkillQuestion = 1 ; int SG553killQuestion = 1 ; //int SG552killQuestion = 1// 1.6, CSS //Sniper killQuestion Integer(s) int SSG08killQuestion = 1 ; int AWPkillQuestion = 1 ; int SCAR20killQuestion = 1 ; int G3SG1killQuestion = 1 ; //Shotgun killQuestion Integer(s) int MAG7killQuestion = 1 ; int SAWEDOFFkillQuestion = 1 ; int XM1014killQuestion = 1 ; int NOVAkillQuestion = 1 ; //int BENELLI_M3killQuestion = 1// 1.6, CSS //LMG killQuestion Integer(s) int M249killQuestion = 1 ; int NEGEVkillQuestion = 1 ; //Other (Weapon) killQuestion Integer(s) int GRENADEkillQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEkillQuestion = 1 ; //Pistol assistQuestion Integer(s) int USPSassistQuestion = 1 ; int P2000assistQuestion = 1 ; int GLOCK18assistQuestion = 1 ; int DUEL_BERRETASassistQuestion = 1 ; int P250assistQuestion = 1 ; //int p228assistQuestion = 1// 1.6, CSS int CZ75assistQuestion = 1 ; int FIVESEVENassistQuestion = 1 ; int TEC9assistQuestion = 1 ; int DESERT_EAGLEassistQuestion = 1 ; int R8_REVOLVERassistQuestion = 1 ; //SMG assistQuestion Integer(s) int MAC10assistQuestion = 1 ; int MP9assistQuestion = 1 ; //int TMPassistQuestion = 1// 1.6, CSS int MP7assistQuestion = 1 ; //int MP5assistQuestion = 1// 1.6, CSS int UMP45assistQuestion = 1 ; int P90assistQuestion = 1 ; int PPBIZONassistQuestion = 1 ; //Rifle assistQuestion Integer(s) int FAMASassistQuestion = 1 ; int GALILARassistQuestion = 1 ; int AK47assistQuestion = 1 ; int M4A1SassistQuestion = 1 ; int M4A4assistQuestion = 1 ; int AUGassistQuestion = 1 ; int SG553assistQuestion = 1 ; //int SG552assistQuestion = 1// 1.6, CSS //Sniper assistQuestion Integer(s) int SSG08assistQuestion = 1 ; int AWPassistQuestion = 1 ; int SCAR20assistQuestion = 1 ; int G3SG1assistQuestion = 1 ; //Shotgun assistQuestion Integer(s) int MAG7assistQuestion = 1 ; int SAWEDOFFassistQuestion = 1 ; int XM1014assistQuestion = 1 ; int NOVAassistQuestion = 1 ; //int BENELLI_M3assistQuestion = 1// 1.6, CSS //LMG assistQuestion Integer(s) int M249assistQuestion = 1 ; int NEGEVassistQuestion = 1 ; //Other (Weapon) assistQuestion Integer(s) int GRENADEassistQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEassistQuestion = 1 ; //Pistol deathQuestion Integer(s) int USPSdeathQuestion = 1 ; int P2000deathQuestion = 1 ; int GLOCK18deathQuestion = 1 ; int DUEL_BERRETASdeathQuestion = 1 ; int P250deathQuestion = 1 ; //int p228deathQuestion = 1// 1.6, CSS int CZ75deathQuestion = 1 ; int FIVESEVENdeathQuestion = 1 ; int TEC9deathQuestion = 1 ; int DESERT_EAGLEdeathQuestion = 1 ; int R8_REVOLVERdeathQuestion = 1 ; //SMG deathQuestion Integer(s) int MAC10deathQuestion = 1 ; int MP9deathQuestion = 1 ; //int TMPdeathQuestion = 1// 1.6, CSS int MP7deathQuestion = 1 ; //int MP5deathQuestion = 1// 1.6, CSS int UMP45deathQuestion = 1 ; int P90deathQuestion = 1 ; int PPBIZONdeathQuestion = 1 ; //Rifle deathQuestion Integer(s) int FAMASdeathQuestion = 1 ; int GALILARdeathQuestion = 1 ; int AK47deathQuestion = 1 ; int M4A1SdeathQuestion = 1 ; int M4A4deathQuestion = 1 ; int AUGdeathQuestion = 1 ; int SG553deathQuestion = 1 ; //int SG552deathQuestion = 1// 1.6, CSS //Sniper deathQuestion Integer(s) int SSG08deathQuestion = 1 ; int AWPdeathQuestion = 1 ; int SCAR20deathQuestion = 1 ; int G3SG1deathQuestion = 1 ; //Shotgun deathQuestion Integer(s) int MAG7deathQuestion = 1 ; int SAWEDOFFdeathQuestion = 1 ; int XM1014deathQuestion = 1 ; int NOVAdeathQuestion = 1 ; //int BENELLI_M3deathQuestion = 1// 1.6, CSS //LMG deathQuestion Integer(s) int M249deathQuestion = 1 ; int NEGEVdeathQuestion = 1 ; //Other (Weapon) deathQuestion Integer(s) int GRENADEdeathQuestion = 1 ; //Expand in the future ie HE, Flash, Decoy, Etc int KNIFEdeathQuestion = 1 ; //Other Question Integer(s) int KilltotalQuestion = 1 ;//(for simple mode) int AssisttotalQuestion = 1 ;//(for simple mode) int DeathtotalQuestion = 1 ;//(for simple mode) int Mode = 0; int STOP = 0; //////////////////////////////////////////////////////////////////////// Active Code Start void setup() { Serial.begin(9600); //////////////////////////////////////////////////////////////////////// Simple/Advanced Startup Mode if (Mode == 0) { Serial.println ("Simple or Advanced Mode? (1 for Simple, 0 for Advanced)"); while (!Serial.available()); // Wait for characters Mode = Serial.read()-48; if (Mode == 1){ delay (1000); Serial.println ("Launching Simple Mode..."); delay (2000); } else { delay (1000); Serial.println ("Launching Advanced Mode..."); delay (2000); } } } //////////////////////////////////////////////////////////////////////// End of Startup void loop() { if (Mode == 1){ goto Simple; } else { goto Advanced; } //////////////////////////////////////////////////////////////////////// Start of Simple Mode code Simple:{ char buffer[]= {' ',' ',' ',' ',' ',' ',' ',' '};// old (using it as a reminder for later) //////////////////////////////////////////////////////////////////////// Rounds Won if (RoundsWonQuestion == 1) { Serial.println ("Rounds Won?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); x = atoi(buffer); Serial.println (x); delay (1000); RoundsWonQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 1 if (STOP == 0) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin(9600); STOP = 1; } //////////////////////////////////////////////////////////////////////// Rounds Lost if (RoundsLostQuesiton == 1) { Serial.println ("Rounds Lost?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); y = atoi(buffer); Serial.println (y); delay (1000); RoundsLostQuesiton = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 2 if (STOP == 1) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) buffer = (char)0; Serial.begin(9600); STOP = 2; } //////////////////////////////////////////////////////////////////////// Aces if (AceQuestion == 1) { Serial.println ("Aces?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); k5 = atoi(buffer); Serial.println (k5); delay (1000); AceQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 3 if (STOP == 2) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) buffer = (char)0; Serial.begin (9600); STOP = 3; } //////////////////////////////////////////////////////////////////////// 4ks if (FourkQuestion == 1) { Serial.println ("4ks?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); k4 = atoi(buffer); Serial.println (k4); delay (1000); FourkQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 4 if (STOP == 3) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) buffer = (char)0; Serial.begin (9600); STOP = 4; } //////////////////////////////////////////////////////////////////////// Suicides if (SuicideQuestion == 1) { Serial.println ("Suicides?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); ds = atoi(buffer); Serial.println (ds); delay (1000); SuicideQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 5 if (STOP == 4) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) buffer = (char)0; Serial.begin (9600); STOP = 5; } //////////////////////////////////////////////////////////////////////// Teamkills if (TeamkillQuestion == 1) { Serial.println ("Teamkills?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); kf = atoi(buffer); Serial.println (kf); delay (1000); TeamkillQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 6 if (STOP == 5) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin (9600); STOP = 6; } //////////////////////////////////////////////////////////////////////// Kills if (KilltotalQuestion == 1) { Serial.println ("Kills?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); KA = atoi(buffer); Serial.println (KA); delay (1000); KilltotalQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 7 if (STOP == 6) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin (9600); STOP = 7; } //////////////////////////////////////////////////////////////////////// Assists if (AssisttotalQuestion == 1) { Serial.println ("Assists?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); AA = atoi(buffer); Serial.println (AA); delay (1000); TeamkillQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 8 if (STOP == 7) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin (9600); STOP = 8; } //////////////////////////////////////////////////////////////////////// Deaths if (DeathtotalQuestion == 1) { Serial.println ("Deaths?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); DA = atoi(buffer); Serial.println (DA); delay (1000); TeamkillQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 9 if (STOP == 8) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin (9600); STOP = 9; } //////////////////////////////////////////////////////////////////////// Headshots if (HeadshotQuestion == 1) { Serial.println ("Headshots?"); while (!Serial.available()); // Wait for characters Serial.readBytesUntil('?', buffer, 3); hk = atoi(buffer); Serial.println (hk); delay (1000); HeadshotQuestion = 0; } //////////////////////////////////////////////////////////////////////// Buffer Reset 10 if (STOP == 9) {Serial.end(); for( int i = 0; i < sizeof(buffer); ++i ) // clears buffer buffer = (char)0; Serial.begin (9600); STOP = 10; } Serial.println (); Serial.println (); Serial.println (); Serial.println (); Serial.println (); //////////////////////////////////////////////////////////////////////// Game Statistics Text Output (Simple Mode) int KDRS = (KA/DA); //Kill Death Ratio Calculation (simple) int HSRS = (hk/KA)*100; //Headshot Percentage Calculation (simple) if (STOP == 10) { Serial.print ("Score: "); Serial.print (x); Serial.print (" - "); Serial.println (y); if (x > y) { Serial.println ("Victory!"); } else if (x < y) { Serial.println ("Defeat!"); } else { Serial.println ("Draw."); } Serial.print ("KDR: "); Serial.println (KDRS); Serial.print ("Headshot Percentage: "); Serial.print (HSRS); Serial.println ("%"); Serial.println ( ); Serial.print ("Total Kills: "); Serial.println (KA); delay (500); Serial.print ("Total Assists: "); Serial.println (AA); delay (500); Serial.print ("Total Deaths: "); Serial.println (DA); Serial.println ( ); delay (500); Serial.print ("Kills Score: "); Serial.println ("Advanced Only"); delay (500); Serial.print ("Assists Score: "); Serial.println ("Advanced Only"); delay (500); Serial.print ("Deaths Score: "); Serial.println ("Advanced Only"); Serial.println ( ); delay (500); Serial.println (ELO); delay (500); STOP = 11; } }////// The Brackets for the end of "Simple Mode" //////////////////////////////////////////////////////////////////////// Start of Advanced Mode Code Advanced:{ if (STOP == 0) { Serial.print ("WIP"); STOP = 1; } }////// The Brackets for the end of "Advanced Mode" }////// End of Void loop
- 21 replies
-
- serial.print
- arduino
-
(and 4 more)
Tagged with:
-
So i made a post yesterday got a little feedback but it didnt solve my problem. im trying to write a sketch for an arduino in witch i have an array of analog inputs witch i want to read all at once and write them to a array of arrays witch i should be able to do in one line to conserve space on the micro heres my code witch i believe works but id like to know how to do it more efficiently const int SliderPin[3] = {14,15,16}; int CurrentProfile = 0; int Profile[4][3]={ {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }; if (CurrentProfile > 3) { CurrentProfile = 0; }; Profile[CurrentProfile][0] = analogRead(SliderPin[0]); Profile[CurrentProfile][1] = analogRead(SliderPin[1]); Profile[CurrentProfile][2] = analogRead(SliderPin[2]);
-
So my graphics card (Radeon 3870) runs pretty hot, and it normally takes manually adjusting fan settings in SpeedFan to keep it below 50. I was getting sick of this, so I went to see if I had a fan with a 3-4 pin connector anywhere. I didn't, but I did have a proprietary Dell 5-pin fan. So I just stuck it in my case, jumpered the red and black wires to 5V and GND on an Arduino respectively, wired a USB power cable for the Arduino through the back of the case, and put the panel back on. It already seems to be making a difference, but will this actually improve performance at all?
-
Hi all, Firstly, I've tried the Arduino forums for help however their account system seems to be a bit broken... (I'm logged in for the account page, I then go to the forum and I'm not logged in, I then log in to find my password is apparently incorrect...) Anyway that's besides the point. Does anyone know how to get the MAC address of a device connected to a HC-05 bluetooth module on an arduino in C? This is so I can get the MAC address of the device and authenticate it in the arduino it's self. Thanks in advance!
-
Hi folks, a friend of mine tried to follow this tutorial about receiving & sending codes with arduinos (it's German): http://www.arduino-tutorial.de/funkuebertragung-von-messwerten-mit-dem-rf-link-modul/ The baseline is, though, that this doen't seem like a copy&paste code. Apparently something got messed up with special characters and their translation (HTML) so the sourcecode ends up not working out of the box. I guess we figured out that " equals " and & is for &, but replacing the characters like that gives us following error when trying to compile: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.1.0_x64__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main': C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.1.0_x64__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: unable to find a register to spill in class 'NO_REGS' } ^ C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.1.0_x64__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\main.cpp:51:1: error: this is the insn: (insn 410 407 413 22 (set (mem:QI (post_dec:HI (reg/f:HI 32 __SP_L__)) [0 S1 A8]) (subreg:QI (reg/f:HI 327) 1)) C:\Users\SQZY\Documents\Arduino\libraries\rc-switch-2.6.2\examples\ReceiveDemo_Simple\ReceiveDemo_Simple.ino:34 1 {pushqi1} (expr_list:REG_ARGS_SIZE (const_int 1 [0x1]) (nil))) C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.1.0_x64__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\main.cpp:51: confused by earlier errors, bailing out lto-wrapper: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.1.0_x64__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status c:/program files/windowsapps/arduinollc.arduinoide_1.8.1.0_x64__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: lto-wrapper failed collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Uno. Original code: /* Receiver build on example "Sending Multiple Variables Using VirtualWire." by Author: Rodrigo Mompo Redoli For controlrobotics.rodrigomompo.com ..............................................................*/ #include <VirtualWire.h> const int led_pin = 13; const int receive_pin = 12; int maxSensorData = 6; int sensorData[6]; char StringReceived[22]; void setup() { Serial.begin(9600); // initialising serial vw_set_rx_pin(receive_pin); // virtual wire setup vw_set_ptt_inverted(true); // virtual wire setup vw_setup(2000); // bits per second vw_rx_start(); // Start the receiver PLL running } // END void setup void loop(){ uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; if (vw_get_message(buf, &buflen)) { //Taking the data from the control base int i; for (i = 0; i < buflen; i++) { StringReceived[i] = char(buf[i]); // data to array } // split data into array sensorData sscanf(StringReceived, "%d,%d,%d,%d,%d,%d", &sensorData[0], &sensorData[1], &sensorData[2], &sensorData[3], &sensorData[4], &sensorData[5]); // Converts a string to an array } for (int i=0; i<maxSensorData; i++){ // nice output Serial.print("Sensor "); Serial.print(i); Serial.print(": "); Serial.print(sensorData[i]); Serial.print("\t"); } Serial.println(""); // linefeed // reset variable StringReceived memset(StringReceived, 0, sizeof(StringReceived)); delay(5); } I am not of big help myself, maybe someone on this forum is knowledgeable here! Regards, SQZY
-
Hello! Even if I couldn't find anything arduino related here at first glance I think it fits best under programming. First of all, I am totally new to programming, only did a few weeks of Arduino for my project, so I would appreciate to keep things as simple as possible. As a project I am currently building a cleaning robot. It is basically justa wooden plate with six dc-motors and 5 ultrasonic sensors that drives around on the floor, avoiding objects, sweeping and hoovering. Only the problem I have is that I cant get to get 5 ultrasonic sensors to work with the standard code I used for up to two sensors: float duration1, distanceR; digitalWrite(TrigPin1, LOW); delayMicroseconds(2); digitalWrite(TrigPin1, HIGH); delayMicroseconds(10); digitalWrite(TrigPin1, LOW); duration1 = pulseIn(EchoPin1, HIGH); distanceR = (duration1 / 2) * 0.0344; delay(10); So that is the code I started with, it works fine for up to two sensors. For more it wont work though, so I also tried to do it with the NewPing library, but I cant figure out how to use the results I get from the NewPing code to make the Arduino do something with the motors. That's the NewPing code: #include <NewPing.h> #define SONAR_NUM 5 #define PING_INTERVAL 50 unsigned long pingTimer[SONAR_NUM]; // When each pings. unsigned int cm[SONAR_NUM]; // Store ping distances. uint8_t currentSensor = 0; // Which sensor is active. NewPing sonar[SONAR_NUM] = { NewPing(7, 6), // First number equals trigger, second number equals trigger. NewPing(8, 9), NewPing(12, 13), NewPing(22, 23), NewPing(24, 27), }; void setup() { Serial.begin (115200); pingTimer[0] = millis() + 75; // First ping start in ms. for (uint8_t i = 1; i < SONAR_NUM; i++) pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL; } void loop() { for (uint8_t i = 0; i < SONAR_NUM; i++) { if (millis() >= pingTimer[i]) { pingTimer[i] += PING_INTERVAL * SONAR_NUM; if (i == 0 && currentSensor == SONAR_NUM - 1) oneSensorCycle(); // Do something with results. sonar[currentSensor].timer_stop(); currentSensor = i; cm[currentSensor] = 0; sonar[currentSensor].ping_timer(echoCheck); } } } void echoCheck() { // If ping echo, set distance to array. if (sonar[currentSensor].check_timer()) cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM; } void oneSensorCycle() { // Do something with the results. for (uint8_t i = 0; i < SONAR_NUM; i++) { Serial.print(i); Serial.print("="); Serial.print(cm[i]); Serial.print("cm "); } Serial.println(); } I copied this form the Arduino forum, and it is detecting all the sensors well and the results get displayed on the serial monitor, just that I cant figure out how to use these results to do something (link on the first code I would just use the distanceR in an if-function to make the robot interact accordingly). Probably it's even the most simplest thing to do, bu as I said, I am a total noob at programming so if anyone could help me I'd highly appreciate it!
-
I created a keyboard of sorts that takes in input from two buttons for 0s and 1s and it will translate them once you get to a full byte of data. Then with the third button on the right it will send that character (or command such as backspace) to the computer. Not practical in any way but I was bored and wanted to see what you guys thought of it. I also plan on putting it on some perf board so it isn't so.. Ugly.
-
Hello everybody, I am working on a new ELO system for csgo and I don't know how to code for it on arduino. WARNING: I AM A NOOB WITH ARDUINO!!! I am looking for a way to use the serial monitor to give me an answer based on my inputs EXAMPLE: if i have the equasion Y=MX+B, I want it (the arduino) to ask me what M, X, and B are then, once i input the answer, solve. This ELO equasion takes into account rounds won/lost KDR (more in that later) and round impact.
- 15 replies
-
- arduino
- calculator
-
(and 3 more)
Tagged with: