Advertisement
pleasedontcode

Scanner rev_102

Nov 2nd, 2023
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Scanner
  13.     - Source Code compiled for: Arduino Mega
  14.     - Source Code created on: 2023-11-02 19:40:28
  15.     - Source Code generated by: AlexWind
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <SoftwareSerial.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. /* Use seril and dsfgds to pass TX and RX data */
  24. /* between them. */
  25. /****** SYSTEM REQUIREMENT 2 *****/
  26. /* Seril TX data is passed to RX dsfgds. dsfgds TX */
  27. /* data is passed to RX Seril. */
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF Software Serial *****/
  34. const uint8_t seril_PIN_SERIAL_TX_A0 = A0; // Define the TX pin for seril
  35. const uint8_t seril_PIN_SERIAL_RX_D6 = 6; // Define the RX pin for seril
  36. const uint8_t dsfgds_PIN_SERIAL_TX_A1 = A1; // Define the TX pin for dsfgds
  37. const uint8_t dsfgds_PIN_SERIAL_RX_A3 = A3; // Define the RX pin for dsfgds
  38.  
  39. SoftwareSerial seril(seril_PIN_SERIAL_RX_D6, seril_PIN_SERIAL_TX_A0); // Create seril object
  40. SoftwareSerial dsfgds(dsfgds_PIN_SERIAL_RX_A3, dsfgds_PIN_SERIAL_TX_A1); // Create dsfgds object
  41.  
  42. void setup(void)
  43. {
  44.   // put your setup code here, to run once:
  45.  
  46.   seril.begin(300); // Initialize seril
  47.   dsfgds.begin(300); // Initialize dsfgds
  48. }
  49.  
  50.  
  51. void loop(void)
  52. {
  53.   // put your main code here, to run repeatedly:
  54.  
  55.   // Pass data from seril TX to dsfgds RX
  56.   if (seril.available()) {
  57.     dsfgds.write(seril.read());
  58.   }
  59.  
  60.   // Pass data from dsfgds TX to seril RX
  61.   if (dsfgds.available()) {
  62.     seril.write(dsfgds.read());
  63.   }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement