Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. class Point_obj{
  2.   public:
  3.     long steps;
  4.     unsigned int seconds;
  5.    
  6.     void offset(int offsetSteps, int offsetSeconds){
  7.       steps += offsetSteps;
  8.       seconds += offsetSeconds;
  9.     };
  10.    
  11.     void set(long setSteps, unsigned int setSeconds){
  12.       steps = setSteps;
  13.       seconds = setSeconds;
  14.     }
  15.    
  16.     void prnt(){
  17.       Serial.print("  step: "), Serial.println(steps);
  18.       Serial.print("  time: "), Serial.println(seconds);
  19.     }
  20. };
  21.  
  22. class Segment_obj{
  23.   public:
  24.     Point_obj start, finish;
  25.     byte smooth;
  26.    
  27.     void shift_key(int offsetSteps, int offsetSeconds){
  28.       start.offset(offsetSteps, offsetSeconds);
  29.       finish.offset(offsetSteps, offsetSeconds);
  30.     };
  31.    
  32.    
  33.    
  34.     void prnt(){
  35.       Serial.println("Data is:");
  36.       Serial.println(" Start");
  37.       start.prnt();
  38.       Serial.println(" Finish:");
  39.       finish.prnt();
  40.     }
  41. };
  42.  
  43. class Path_obj{
  44.   public:
  45.   byte TotalKeys;
  46.   Point_obj Key[6];
  47.   Segment_obj Segment[5];
  48. };
  49.  
  50.  
  51.  
  52. void setup() {
  53.   Serial.begin(9600);
  54.  
  55. }
  56.  
  57. void loop() {
  58.   Path_obj Motor[3];
  59.  
  60.   Motor[0].Segment[0].start.set(0, 0);
  61.   Motor[0].Segment[0].finish.set(5, 6);
  62.  
  63.   Motor[0].Segment[0].prnt();
  64.  
  65.  
  66.   while(1);
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement