Shop OBEX P1 Docs P2 Docs Learn Events
Trying to join two objects — Parallax Forums

Trying to join two objects

lockadoclockadoc Posts: 115
edited 2015-06-28 08:03 in Propeller 1
I want to join two objects, and I just don't get it.
I have two books, Propeller Manual, and Propeller Education Kit Labs: Fundamentals.
But I still don't get it.
I want to have both programs run at the same time.

what I would like help with at this moment is getting both to run at the same time
and the name of the four variables that carry the four Fahrenheit temperatures from the
" modified_ds1822_6-1-15" object, that I will be trying to incorporate into the
" _ml_graphics_demo_v02" object.

Thanks in advance
Bill S.

Comments

  • kwinnkwinn Posts: 8,697
    edited 2015-06-28 06:24
    A common method of doing what you want is to have a "main" program start the two objects, then read the temperature from the ds1822, perform any necessary data conversions, and write the data to the graphics program. The objects usually have functions for reading or writing data.

    Sorry I can't be more specific but I cannot read/decompress the attached file or find the objects in the OBEX.
  • PublisonPublison Posts: 12,366
    edited 2015-06-28 07:29
    I attached a regular zip file.
  • kwinnkwinn Posts: 8,697
    edited 2015-06-28 08:03
    '==================================================================
    PUB Main_Program | index1, index2, inc1, inc2 ,  A_Val, B_Val, indicator1, indicator2
    '==================================================================
    'This is the main object in the running program that generates the values to display
    
       initialize                 
    
      Indicator1 := 2
      Indicator2 := 516 
      index1 := 100
      index2 := 10
      Inc1  := 5
      Inc2  := 4
                 ' A_Val  := 100
                  'B_Val  := 100
    
    
          repeat
                 
          
    ******************************************************************************************************** 
    ' REPLACE THIS SECTION OF CODE WITH CODE THAT READS THE TEMPERATURE
    ' AND SET INDEX1 TO TEMPERATURE1, INDEX2 TO TEMPERATURE2
       
                  index1 := index1 + Inc1
                    if  index1 > 600 
                        Inc1 := ( -5 )
                        Indicator1 := 2 
                    elseif  index1 < 3   
                        Inc1 := (  5 )
                        Indicator1 := 1 
                       
                           
                  index2 :=  index2 + Inc2
                    if  index2 > 600 
                        Inc2 := ( -4 )
                        
                    elseif  index2 < 3   
                        Inc2 := (  4 )
    *********************************************************************************************************                    
      
                  A_Val  := index1
                  B_Val  := index2
       
                  DiaplayGauges( A_Val, B_Val, indicator1, indicator2 )
                  
               '   waitcnt(clkfreq  + cnt)
    
    I downloaded your attachment and got 7 zip to decompress it this time, so I could look at the code. This should point you in the right direction. Sorry, no hardware atm to test with.
    Use the Graphics demo code as your main program and replace the code indicated above with the code from the modified ds1822 object that reads the temperature. You will need to add the 1-wire object to the Graphics demo.
Sign In or Register to comment.